Setting Logrotate for Custom Apache

by dt on September 8th, 2009

Because in cPanel, Apache web server is compiled from sources and install in a custom location, you need to configure logrotate to split and compress logs. To do this, create a file /etc/logrotate.d/httpd with this content:

/usr/local/apache/logs/*log {
    create 0640 root root
    rotate 4
    daily
    compress
    postrotate
        /sbin/service httpd restart > /dev/null 2>/dev/null || true
    endscript
}

then force logrotate to rotate logs: 

logrotate -fv /etc/logrotate.d/httpd

If you have munin installed from cPanel, you need to make similar settings for it. Munin logs are saved in /var/log/munin and usually grow fast.

shorturl: