logrotate

From WebHostingNeeds.com
Jump to: navigation, search

To rotate apache log file


vi /etc/logrotate.d/httpd

Add the following:

/var/log/httpd/*_log {
missingok
notifempty
sharedscripts
postrotate
/usr/bin/killall -HUP httpd
endscript
}

For rotating logs daily on CentOS/RHEL

/var/log/httpd/*log {
    daily
    maxage 30
    compress
    dateext
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}


chmod 640 /etc/logrotate.d/httpd



apache

linux commands