In another thread, I had posted that we rotate our mongrel production
logs once a week as a means to keep the performance degradations that
happen with large log files at bay.  A few of you asked me to post how
we do it, so here it is.  We run our sites on RedHat Enterprise 4
machines.  Our logrotate.conf file looks like this:

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.

# mongrel logs
/path/to/rails/root/shared/log/*.log {
        copytruncate
        weekly
        missingok
        dateext
        compress
        sharedscripts
        olddir /path/to/rails/root/old_mongrel_logs
        rotate 28
        postrotate
          for i in `ls /path/to/rails/root/shared/log/mongrel*.pid`; do
            kill -USR2 `cat $i`
          done
        endscript
}



Incidentally, we also use monit to monitor our various processes
(mongrel, Apache, ferretDRb MySQL, etc), so if for some odd reason
this log rotation would not bring one of our mongrels back up cleanly,
we'd be alerted and monit would try to restart it.  So far, this has
not happened at all across any of our 6 production setups just like
this.

None of the sites are extremely high traffic, so it's possible that
you'd want to rotate mongrel log files more frequently than weekly.

I hope this helps.

-- 

Sean Brown
[EMAIL PROTECTED]
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to