Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

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.

share|improve this answer
    
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 Nov 13 '09 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. :-) –  Andrew Flanagan Nov 13 '09 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 Nov 16 '09 at 16:38

Your Answer

 
discard

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.