Social Media

Category Archives for Uncategorized

Apache Log Rotation on Windows

Thie example uses Apache 2.4, 64-bit version from apachehaus, and the rotatelogs.exe contained in this project –

https://www.apachehaus.com/cgi-bin/download.plx

Unzip the apache download and go to the bin folder, and confirm there is a rotatelogs.exe file. Install the server as either a service, or start from the bin folder, and confirm it works.

Now lets configure rotatelogs.exe for an initial test of every 10s –

The file names use the strftime format –

http://httpd.apache.org/docs/current/programs/rotatelogs.html

Restarting the The log directory then shows files with names like –

So lets change it to a daily rotate – or 60*60*24s = 86400s –

The final change is to the error log – we dont need to rotate this daily as its smaller than the access_log, but we can use rotatelogs to rotate on file size, in this case 10MB –

Becomes –

Issues

  • Starts an extra external process – rotatelogs.exe – for each log
  • Piping on windows is a bit ropy
  • You cant configure monthly as an interval

Alternatives

mod_log_rotate – https://github.com/JBlond/mod_log_rotate

This is a Apache Shared Object – so operates the same as rotatelogs, but within the apache processes

Example Usage –

To rotate the logs monthly the advice is to use LogRotateWin, a windows version of the unix command logrotate (http://www.linuxcommand.org/man_pages/logrotate8.html) –

LogRotateWin – https://sourceforge.net/projects/logrotatewin/

This operates as a daily task, and processes the configuration file. To rotate monthly you can use the following

References –

http://serverfault.com/questions/577908/what-are-the-drawbacks-to-using-mod-log-rotate-and-rotatelogs-exe-together
https://www.digitalocean.com/community/tutorials/how-to-manage-log-files-with-logrotate-on-ubuntu-12-10
https://sourceforge.net/p/logrotatewin/wiki/LogRotate/

1 5 6 7 8 9 45