Apache 2 Log Rotations

Jim O'Halloran • December 18, 2002

linux-and-open-source

I've been having problems with Apache 2 segfaulting when the Red Hat Log Rotation job is run... /etc/logrotate.d/apache has been changed as follows to try and resolve this...

/var/log/httpd/*_log {
    monthly
    rotate 12
    missingok
    prerotate
        /usr/local/apache2/bin/apachectl stop
    endscript
    postrotate
        /usr/local/apache2/bin/apachectl start
    endscript
}

I've added the prerotate and postrotate lines to shut down apache while the logs are being moved, so hopefully this will resolve the problem.

UPDATE (1/1/03): Had the path to apachectl wrong, now fixed in the above.