Wednesday, January 25, 2012

Linux Log Rotation

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.

File location 

       /var/lib/logrotate.status  Default state file.
       /etc/logrotate.conf        Configuration options.

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    minsize 1M
    create 0664 root utmp
    rotate 1
}

# sample logrotate configuration file
       compress

       /var/log/messages {
           rotate 5
           weekly
           postrotate
                                     /sbin/killall -HUP syslogd
           endscript
       }

No comments:

Post a Comment