Rolling Apache2 log files

2

I'm using a Collabnet svn distribution on linux, and the log files are configured through the standard apache httpd.conf. It's been a while since I dealt directly with apache, but my memory and google seem to indicate that the only way to rotate apache log files is outside of apache, using a periodic script.

Is there some convenient way I'm missing to rotate these?

Andrew B

Posted 2010-03-18T20:05:31.740

Reputation: 143

Answers

2

Apache provides a tool call "rotatelogs". It can be configured inside the httpd.conf file, so no need to schedule a tool to do the rotation.

See this page for more information: rotatelogs - Piped logging program to rotate Apache logs

Snark

Posted 2010-03-18T20:05:31.740

Reputation: 30 147

Doesn't that first sentence sort of contradict itself? Essentially what it comes down to is "Apache provides a tool you can use to schedule log rotation, so you don't need to schedule a tool to do log rotation" :P , +1 from me. – John T – 2010-03-18T20:12:16.237

Not sure I understand your comment ... the rotation tool is external but does not need to be scheduled in crontab/Scheduled Tasks. It's called directly from the conf file and manages the rotation on its own. Thx for the +1. – Snark – 2010-03-18T20:16:53.110

That's what I was looking for. It'd be even better if it allowed you to retain only a certain number of archives, but that's easy enough to do. – Andrew B – 2010-03-18T20:18:24.417