I administrate a Windows Server 2003 (Standard Edition, 32-bit) installation running Apache2 and ColdFusion. The server has over 100 virtual hosts, each with an access log and an error log. I've been looking for an analog to (or a win32 port of) the classic Linux logrotate command, which allows logfile rotation without interrupting Apache's locking mechanism.

Every solution I've found, including chomp, the conflictingly named logrotate bash script, apachelogrot, and several Perl log rotation scripts; they all:

  • stop apache
  • rotate the log
  • start apache

Obviously, this is not desirable with so many virtual hosts, as it would stop and restart Apache hundreds of times per night.

I have also investigated using rotatelogs, which comes with apache, and cronolog, which use piped output to create individual daily/weekly/monthly logs. These programs do not require a restart of apache to rotate the logs, but they spawn an instance of the process for each logfile, resulting in hundreds of additional daemons running, each consuming 200-300k of memory.

I also tried compiling the classic Linux logrotate command on cygwin, but with no luck.

Do any of you have suggestions about what I should try next? Or, even better, have any of you managed to get the classic Linux logrotate command to compile on cygwin, or any other win32 compiler?

1 Answer 1


As a workaround, you may be able to switch to use a single log for all virtual hosts and post-process them using split-logfile or something similar (to get them into individual logs per virtual host). This is recommended in Apache's docs here. Not sure if it's an option in your environment.

  • That's an excellent suggestion, it may be a possibility. I'm still looking for the preferred solution though - some program with features closer to the "copytruncate" feature of Linux's rotatelogs utility.
    – Joe
    Commented Nov 13, 2009 at 17:26
  • I think you're going to be stuck with Windows file handling limitations in all cases. I'm definitely interested too if you find a workaround though, so please post back to the thread. :-) Commented Nov 13, 2009 at 23:50
  • I've been doing some testing with Perl-logrotate (find it on freshmeat.net). It looks promising! I'll update the thread when I can confirm that it emulates "copytruncate" to my satisfaction.
    – Joe
    Commented Nov 16, 2009 at 16:38

You must log in to answer this question.

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