You are here Home > Know-how > Linux > System Administration > logrotate

Linux Reference

6.8 logrotate


20.02.2008
6.7 rsync [  up  ] - [ top ] - [ linux a-z ] 6.9 Tips: Backup Files

logrotate - rotates, compresses, and mails system logs

logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.

vi /etc/cron.daily/logrotate

vi /etc/logrotate.conf

1.)  cd /etc/logrotate.d

2.)  # cat httpd
# XX /var/log/httpd/*log {
/usr/local/apache2/logs/*_log {
    missingok
    notifempty
    sharedscripts
    postrotate
/bin/kill -USR1 `cat /usr/local/apache2/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

Debugging

logrotate -d /etc/logrotate.conf

-d Turns on debug mode and implies -v. In debug mode, no changes will be made to the logs or to the logrotate state file.



copyright by retoh - created with mytexi