{ lib, config, ... }: let cfg = config.this.syslog; in { options = { this.syslog.enable = lib.mkEnableOption "syslogger"; }; config = lib.mkIf cfg.enable { services.rsyslogd = { enable = true; defaultConfig = builtins.readFile ./rsyslogd.conf; }; services.logrotate = { enable = true; settings = { header = { create = "0640 root adm"; missingok = true; notifempty = true; frequency = "weekly"; rotate = 4; compress = true; delaycompress = true; minsize = "1M"; }; "rsyslogd" = { files = [ "/var/log/syslog" "/var/log/mail.log" "/var/log/kern.log" "/var/log/auth.log" "/var/log/user.log" "/var/log/cron.log" ]; sharedscripts = true; postrotate = "systemctl kill -s HUP syslog.service"; }; }; }; }; }