We're running Apache 2.2.9 (Win32) with a few virtual hosts configured on the one server. Each has it's own ErrorLog and CustomLog settings which are in the format of "logs/[domain name]-error.log" and "logs/[domain name]-access.log". Unfortunately these are now creating quite large files.

On IIS you can specify the log schedule, which can put them in a daily format of "yymmdd.log". Is there something similar I can do here?

It doesn't have to be daily either, weekly or monthly will do. I'd just like to break them up so that we can keep X amount instead of everything it's ever logged. A quick Google seems to bring up lots of Linux orientated answers involving log splitters, scripts and cron jobs which isn't too helpful for a Windows installation.


Thanks to radius, I tweaked my httpd-vhosts.conf to use Apache's built in rotatelogs command, in the following format:

ErrorLog "|bin/rotatelogs logs/[domain name]-error.%Y-%m-%d-%H_%M_%S.log 5M" CustomLog "|bin/rotatelogs logs/[domain name]-access.%Y-%m-%d-%H_%M_%S.log 5M" common

They'll create a new log file when the current one reaches 5MB. I know that's not daily as asked for, but that keeps them at a manageable size which will do. I did try the rotate after so many seconds but it didn't seem to be putting the time stamp in the file name correctly (specifically hours, minutes and seconds).

4 Answers 4


What you're looking for is the rotatelogs program that comes with apache http://httpd.apache.org/docs/2.2/programs/rotatelogs.html

For instance, to rotate your logs daily at midnight:

CustomLog "|bin/rotatelogs -f /var/log/apache2/logfile.%Y.%m.%d.log 86400" common
  • +1, didn't know Apache had a solution of it's own.
    – Karolis T.
    Jun 17, 2009 at 9:14
  • 1
    For anyone using Ubuntu you might need to change the path to /usr/bin/rotatelogs, as that is where rotatelogs is found. Otherwise Apache will fail to restart due to an error.
    – BadHorsie
    Dec 12, 2019 at 15:04

What you want is called log rotation.

Google seems to list some revelant links about log rotation tools for windows.

This seems like an Apache specific solution, maybe it'll help you:



Docs here:



Try direct with

CustomLog "|C:/<chemin vers apache>/bin/rotatelogs.exe E:/<chemin vers les logs>/<monsite>/access-%Y_%m_%d.log 86400 60" combined
  • 2
    Please add an explanation of what this does.
    – kasperd
    Nov 10, 2015 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .