Social Media

Apache Log Rotation on Windows

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

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 –

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 –


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


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 ( –

LogRotateWin –

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

References –

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment: