« November 2008 | Main | January 2009 »

December 1, 2008

logrotate config files

Intro

Redhat uses the logrotate to manage the rotation of log files. The files end up in /var/log or a subdirectory of that directory.

Main logrotate config file ( /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
# 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 -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

Specific file for httpd (/etc/logrotate.d/httpd ) overrides file above

/var/log/httpd/*log {
# keep 52 weeks worth of backlogs  
    rotate 52
    missingok
    notifempty
    sharedscripts
    compress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}