Update logrotate configs to preserve last 7 days
This commit is contained in:
parent
786ecd554f
commit
4a11950728
@ -1,37 +0,0 @@
|
|||||||
/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
|
|
||||||
}
|
|
@ -64,7 +64,33 @@
|
|||||||
line: "MaxRetentionSec=7day"
|
line: "MaxRetentionSec=7day"
|
||||||
notify: Restart journald
|
notify: Restart journald
|
||||||
|
|
||||||
- name: Configure log retention
|
- name: Set logrotate.conf to daily
|
||||||
copy: src={{ item }} dest=/etc/logrotate.d/{{ item }}
|
replace:
|
||||||
with_items:
|
path: "/etc/logrotate.conf"
|
||||||
- rsyslog
|
regexp: "(?:weekly|monthly)"
|
||||||
|
replace: "daily"
|
||||||
|
|
||||||
|
- name: Set logrotate.conf rotation to 7
|
||||||
|
replace:
|
||||||
|
path: "/etc/logrotate.conf"
|
||||||
|
regexp: "rotate [0-9]+"
|
||||||
|
replace: "rotate 7"
|
||||||
|
|
||||||
|
- name: Find logrotate.d configuration files
|
||||||
|
find:
|
||||||
|
paths: "/etc/logrotate.d/"
|
||||||
|
register: "logrotateconfigs"
|
||||||
|
|
||||||
|
- name: Set logrotate.d/* to daily
|
||||||
|
replace:
|
||||||
|
path: "{{ item }}"
|
||||||
|
regexp: "(?:weekly|monthly)"
|
||||||
|
replace: "daily"
|
||||||
|
loop: "{{ logrotateconfigs.files }}"
|
||||||
|
|
||||||
|
- name: Set logrotate.conf rotation to 7
|
||||||
|
replace:
|
||||||
|
path: "{{ item }}"
|
||||||
|
regexp: "rotate [0-9]+"
|
||||||
|
replace: "rotate 7"
|
||||||
|
loop: "{{ logrotateconfigs.files }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user