Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a script that would rotate weblogs on apache. I'd like to schedule the script over cron so it could run periodically and rotate access_log and error_log for all websites on the server.

Thanks, Mark

share|improve this question

Another good tool is Cronolog

cronolog is a simple filter program that reads log file entries from standard input and writes each entry to the output file specified by a filename template and the current date and time. When the expanded filename changes, the current file is closed and a new one opened. cronolog is intended to be used in conjunction with a Web server, such as Apache, to split the access log into daily or monthly logs.

Example Configuration:

 CustomLog "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/access.log"
 ErrorLog  "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/errors.log"

Will produce and rotate logs automaticlly to:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.