Notes logrotate

Voir :

https://access.redhat.com/documentation/fr-fr/red_hat_enterprise_linux/7/html/system_administrators_guide/s1-basic_configuration_of_rsyslog#s2-log_rotation

Voir aussi :

tmpfiles.d (SystemD)

#!/bin/sh /usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1 EXITVALUE=$? if [ $EXITVALUE != 0 ]; then /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" fi exit 0

Exemple de conf

/opt/atom/apache-tomcat-*/logs/catalina.out
{
copytruncate
weekly
rotate 52
compress
missingok
size 5M
}
/var/log/cups/*_log {
missingok
notifempty
sharedscripts
}
/var/log/dracut.log {
missingok
notifempty
size 30k
yearly
create 0600 root root
}
/var/log/clamav/freshclam.log {
missingok
notifempty
create 644 clam clam
}
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
delaycompress
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
/var/log/numad.log {
compress
copytruncate
maxage 60
missingok
rotate 5
size 1M
}
# Rotate OCS Inventory NG agent logs daily, only if not empty
# Save 7 days old logs under compressed mode
/var/log/ocsinventory-agent/*.log {
daily
rotate 7
compress
notifempty
missingok
}
/var/account/pacct {
#prerotate loses accounting records, let's no
# prerotate
# /usr/sbin/accton
# endscript
compress
delaycompress
notifempty
daily
rotate 31
create 0600 root root
postrotate
/usr/sbin/accton /var/account/pacct
endscript
}
/var/log/sssd/*.log {
weekly
missingok
notifempty
sharedscripts
rotate 2
compress
postrotate
/bin/kill -HUP `cat /var/run/sssd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
/var/log/yum.log {
missingok
notifempty
size 30k
yearly
create 0600 root root
}

Test

logrotate -df /etc/logrotate.d/plop