Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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).

share|improve this question
up vote 10 down vote accepted

What you're looking for is the rotatelogs program that comes with apache

For instance, to rotate your logs daily at midnight:

CustomLog "|bin/rotatelogs -f /var/log/apache2/logfile.%Y.%m.%d.log 86400" common
share|improve this answer
+1, didn't know Apache had a solution of it's own. – Karolis T. Jun 17 '09 at 9:14

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:

share|improve this answer

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
share|improve this answer
Please add an explanation of what this does. – kasperd Nov 10 '15 at 13:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.