falkenstein: configure log retention

This commit is contained in:
Rouven Seifert 2024-03-23 00:32:12 +01:00
parent a8d2ace6ab
commit c776c72286
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
3 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
services.rsyslogd = {
enable = true;
defaultConfig = ''
:programname, isequal, "postfix" /var/log/postfix.log
auth.* -/var/log/auth.log
'';
};
services.logrotate.configFile = pkgs.writeText "logrotate.conf" ''
weekly
missingok
notifempty
rotate 4
"/var/log/postfix.log" {
compress
delaycompress
weekly
rotate 156
dateext
dateformat .%Y-%m-%d
extension log
}
"/var/log/nginx/*.log" {
compress
delaycompress
weekly
postrotate
[ ! -f /var/run/nginx/nginx.pid ] || kill -USR1 `cat /var/run/nginx/nginx.pid`
endscript
rotate 26
su nginx nginx
}
'';
}