[root@deyu ~]# find /etc/cron* -name logrotat* /etc/cron.daily/logrotate [root@deyu ~]# cat /etc/cron.daily/logrotate #!/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
[root@deyu ~]# cat /etc/logrotate.conf # see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # use date as a suffix of the rotated file dateext # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d # no packages own wtmp and btmp -- we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp minsize 1M rotate 1 } /var/log/btmp { missingok monthly create 0600 root utmp rotate 1 } # system-specific logs may be also be configured here.
[root@deyu ~]# man logrotate
[root@deyu ~]# logrotate -v /etc/logrotate.conf reading config file /etc/logrotate.conf including /etc/logrotate.d reading config file cups reading config info for /var/log/cups/*_log reading config file httpd reading config info for /var/log/httpd/*log ........ Handling 13 logs rotating pattern: /var/log/httpd/*log weekly (4 rotations) empty log files are not rotated, old logs are removed considering log /var/log/httpd/access_log log does not need rotating considering log /var/log/httpd/error_log log does not need rotating not running postrotate script, since no logs were rotated ...... considering log /var/log/messages log does not need rotating ...... rotating pattern: /var/log/wtmp monthly (1 rotations) empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed considering log /var/log/wtmp log does not need rotating