logrotate and mongrel (mongrel_cluster)
July 16, 2007
I’ve never actually explored log rotation tools in Linux and merely knew of the existence of logrotate and left it at that until log sizes really became a problem. Turns out logrotate is amazingly easy to configure, and thanks to this Logrotate and Mongrel blog post by Corey Donohoe I have it setup for my Rails applications that are running on Mongrel. Here’s what my /etc/logrotate.d/mongrel_cluster looks like:
/var/railsapps/APP_NAME/shared/log/production.log {
daily
rotate 28
missingok
compress
sharedscripts
postrotate
for i in `ls /var/railsapps/APP_NAME/shared/log/*.pid`; do
kill -USR2 `cat $i`
done
endscript
}





minor point, but I don’t think there’s any need to do the “ls with backticks thing” -just do a “/var/railsapps/APP_NAME/shared/log/*.pid”,and that should be fine… RESPEK for your jsonifier post, btw!!! ;P
Posted by: jeff on July 18, 2007 12am