how frequently logrotate will rotate the logs, whether to compress the log
files, whether it is okay for the log file to be missing, and whether to bother
rotating if the file is empty. Pretty straightforward again. Here is a more
complex example, for rsyslog, the system logging program:
Click here to view code image
/var/log/syslog
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
postrotate
reload rsyslog >/dev/null 2>&1 || true
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 4
weekly
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
reload rsyslog >/dev/null 2>&1 || true
endscript
}
The man page for logrotate defines all the commands used in these
configuration files, but many are probably clear to you already. Here are some
of the most important ones:
rotate—Defines how many archived logs are kept at any one time