From f184ca15fe00ab18d102ee30469b08b4aaaa7622 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Sun, 2 Feb 2020 20:57:28 +0100 Subject: [PATCH] common: limit syslog retention to 7 days --- roles/common/files/rsyslog | 37 +++++++++++++++++++++++++++++++++++ roles/common/tasks/Debian.yml | 5 +++++ 2 files changed, 42 insertions(+) create mode 100644 roles/common/files/rsyslog diff --git a/roles/common/files/rsyslog b/roles/common/files/rsyslog new file mode 100644 index 0000000..0cc2aa9 --- /dev/null +++ b/roles/common/files/rsyslog @@ -0,0 +1,37 @@ +/var/log/syslog +{ + rotate 7 + daily + missingok + notifempty + delaycompress + compress + postrotate + /usr/lib/rsyslog/rsyslog-rotate + endscript +} + +/var/log/mail.info +/var/log/mail.warn +/var/log/mail.err +/var/log/mail.log +/var/log/daemon.log +/var/log/kern.log +/var/log/auth.log +/var/log/user.log +/var/log/lpr.log +/var/log/cron.log +/var/log/debug +/var/log/messages +{ + rotate 7 + daily + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + /usr/lib/rsyslog/rsyslog-rotate + endscript +} diff --git a/roles/common/tasks/Debian.yml b/roles/common/tasks/Debian.yml index c82c6c0..3c2a409 100644 --- a/roles/common/tasks/Debian.yml +++ b/roles/common/tasks/Debian.yml @@ -63,3 +63,8 @@ regexp: "^#?MaxRetentionSec=.*" line: "MaxRetentionSec=7day" notify: Restart journald + +- name: Configure log retention + copy: src={{ item }} dest=/etc/logrotate.d/{{ item }} + with_items: + - rsyslog