Apache provides a tool called rotatelogs which has the benefit of not restarting apache when rotating logs which happens with logrotate. I do not have enough experience to speak if this is enough criteria to use rotatelogs over logrotate.

My questions is does anyone have real life experience using either or of these two tools and what were your input would be?

What would you recommend and why?

link|improve this question
feedback

1 Answer

I would recommend logrotate for most people since that is what will be rotating all the other logs (KISS: Keep it Simple Stupid). Logrotate doesn't restart all of Apache, rather it just sends it a signal that tells it to reopen all of it's log files and restart children. This signal can be SIGHUP, which causes the children to restart right away (which will interrupt downloads), or SIGUSR1, which does a graceful restart. With SIGUSR1, you have to delay the log processing until you think all the children would have died naturally. Either way, you probably want to analyze your logs, and time it for the lowest traffic period in the day or week.

Piped logs seems like it is the more powerful solution. A big advantage being that it will allow you to use a centralized logging system and take load of the web server itself. The manual itself says:

As with conditional logging, piped logs are a very powerful tool, but they should not be used where a simpler solution like off-line post-processing is available.

So apparently, don't use piped logging if you don't need it. I have used piped loging in the past as a hacky way to filter logs, and had no problem.

link|improve this answer
The postrotate script with Apache's logrotate files is to send a SIGHUP, which causes Apache to terminate all children and restart. Any active connections at the time are terminated. – Warner Mar 8 '10 at 18:37
I read a comment somewhere that said graceful restart does not work very well with servers carrying a heavy load. But I really do not think there is much of an alternative. – Mohan Gulati Mar 8 '10 at 19:10
logrotate with SIGHUP is pretty standard. I wouldn't worry about it. – Warner Mar 8 '10 at 19:17
cool Thanks guys – Mohan Gulati Mar 8 '10 at 19:18
feedback

Your Answer

 
or
required, but never shown

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