I recently had an issue where I have a Zope instance installed from source and found that the Z2.log and event.log files were 17GB and 30GB respectively.
Poking around the google, I found this reference to newsyslog.conf: http://www.wrightthisway.com/Articles/000437.html
I added this entry just for testing to see if this would work as advertised.
#logfilename [owner:group] mode count size when flags
/Path/to/Zope/log/event.log owner:group 644 5 5000 * J
This entry tells newsyslogd to rotate the event.log file when it reaches 5000kB (5MB) and create the new file with specified owner:group permissions. In addition keep 5 copies of the log file and compress them with bzip2 compression.
You can rotate your logs at the command line with: sudo newsyslog -F
UPDATE: With this solution, the Zope service doesn’t get restarted so it doesn’t continue to write to the newly created log file.
There is an option to give PID but I have a suspicion that the process will be hung up and not restarted.
I found this http://httpd.apache.org/docs/1.3/logs.html#rotation
where I can use the rotatelogs apache command which is a piped log that allows log rotation without having to restart the service.
In order to use the rotatelogs command you would add an entry like below in your httpd.conf file. I would change the entries to be all ErrorLog entries and only have the combined entries for Apache combined access logs. The 5M is once the log file is 5M and the -420 is an offset for Pacific standard time.
CustomLog ‘|/usr/sbin/rotatelogs “/usr/local/apache2/logs/access_log” 5M -420’ “%h %l %u %t \”%r\” %>s %b”
ErrorLog ‘|/usr/sbin/rotatelogs “/usr/local/apache2/logs/error_log” 5M -420’