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

2 Answers 2

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:

 /web/logs/2009/09/25/access.log
 /web/logs/2009/09/25/errors.log
share|improve this answer

Your Answer

 
discard

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