Apache daily logrotate

Solution 1:

Apache lets you pipe log files to another program which can then handle rotation without having to reload/restart Apache. Apache even provides a program to do this.

ErrorLog "|bin/rotatelogs -l -f /var/log/apache2/errlogfile.%Y.%m.%d.log 86400" common
CustomLog "|bin/rotatelogs -l -f /var/log/apache2/logfile.%Y.%m.%d.log 86400" common

Solution 2:

Try running logrotate manually to look for errors: logrotate -d /etc/logrotate.d/httpd. The manual says "-d Turns on debug mode and implies -v. In debug mode, no changes will be made to the logs or to the logrotate state file."

This is what we're using successfully:

/var/log/httpd/*log {
  daily
  dateext
  dateformate -%d-%m-%Y
  missingok
  nocompress
  rotate 30
  postrotate
    /sbin/service httpd reload > /dev/null 2>/dev/null || true
  endscript
}