Apache Log Rotation with mod_log_rotate and error.log

The initial configuration works on my logs/access.log file but does not rotate my logs/error.log file - what changes should I make to the default ErrorLog configuration to get the error.log file also rotated daily?

Charles Michener

Apache log rotation

I am using the mod_log_rotate.so file with RotateLogs On and RotatelLogsLocalTime On. My logs are rotating at 8:09pm EST instead of midnight, the time/zone on the server is correct.....any suggestions?

Also is there a paramater that can be used to set the day of the week?


Apache & mod_log_rotate log timestamps

I'm not sure the timestamp of the log file indicates the log rotation. It's the last write time.

Not sure about this but, I can see on some of my sites with no traffic the log rotation file date reflecting the last log entry in the log file.

In other words, look in the log file with a last "write date" of 8:09pm EST. Do you have a log entry past the 8:09pm mark ?

Apache with the mod_log_rotate module does not use the same algorithm then IIS for the handling of log files. With IIS the log file cache is 128KB(or 64KB) per log file. This cache is not cleared until midnight. So all log files have a timestamp of around midnight. With Apache & mod_log_rotate, I notice that my sites have logs files with timestamps all over the map. With one consistency: my high traffic sites all have a timestamp past 11:59PM.

If you look inside the log file you will see that all is in order (I just checked a few log files my self): entries go from 00:00 to 23:59 for busy site. Even though timestamps of the log files are all over the map.

Let me know what you think,

This module does not rotate your error.log.

Hi Charles,

I posted your email in the Forums. Please do not email these issues to me. Post directly in the forums, thanks.

This module does not rotate your error.log.

I personally would not need to rotate the error.log since it does not grow much. If you error.log grows rapidly, I would recommend troubleshooting the root cause.

error.log actually does grow much under some circumstances

The apache error.log does tend to grow a lot if your webserver is under some forms of attack, e.g. someone trying to get access to default internal configuration pages. In that case you'll find a lot of 'File does not exist' or 'client denied by server configuration' errors in the log file.