fruitbasket/modules/core/logging.nix

35 lines
711 B
Nix
Raw Normal View History

2024-03-14 23:59:42 +01:00
{ pkgs, ... }:
{
services.rsyslogd = {
enable = true;
defaultConfig = ''
2024-07-24 10:53:35 +02:00
$FileCreateMode 0640
2024-03-14 23:59:42 +01:00
: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
}
"/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
}
'';
}