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