Rotating production logs

8 views
Skip to first unread message

Tomek Piatek

unread,
Feb 13, 2007, 5:05:49 PM2/13/07
to WellR...@googlegroups.com
Anyone have any experience rotating Rails production logs in the case where there are multiple instances of the same app running under mongrel cluster (UNIX)? How do you do it? Do you use a tool like "logrotate" or do you use Rail's built in facility? Is there a best practice for this?

-t

Michael Koziarski

unread,
Feb 13, 2007, 5:20:17 PM2/13/07
to WellR...@googlegroups.com
It's hardly best practise, but we have a small script that gets run @nightly.

NEW_LOGFILE=log/production.log.`date +%Y%m%d`

cd RAILS_ROOT
cp log/production.log $NEW_LOGFILE
cat /dev/null > log/production.log
/usr/bin/pl_analyze log/production.log.`date +%Y%m%d` -e mic...@koziarski.com
gzip $NEW_LOGFILE


An easier option (if you can) is using the robot-coops sysloglogger,
which means you can use all the standard syslog configuration options
for log rotation


--
Cheers

Koz

Nik Wakelin

unread,
Feb 13, 2007, 5:22:02 PM2/13/07
to WellR...@googlegroups.com
Does anyone know of a good tutorial for that robot co-op syslogger, or
a basic explanation of it?

I investigated it for use in conjunction with pl_analyze, but I can't
figure out how to hook it in to Rails (+ Capistrano) properly.


--
Nik Wakelin
(027) 424 5433
munky...@gmail.com

Michael Koziarski

unread,
Feb 13, 2007, 5:26:31 PM2/13/07
to WellR...@googlegroups.com
On 2/14/07, Nik Wakelin <munky...@gmail.com> wrote:
>
> Does anyone know of a good tutorial for that robot co-op syslogger, or
> a basic explanation of it?
>
> I investigated it for use in conjunction with pl_analyze, but I can't
> figure out how to hook it in to Rails (+ Capistrano) properly.

Eric's documentation is somewhat lacking, and contains errors.
However geoff grosenbach has a good hack to let you work with
pl_analyze without sysloglogger

http://nubyonrails.com/articles/2007/01/03/a-hodel-3000-compliant-logger-for-the-rest-of-us

We're using that at planhq, seems to work pretty well.

--
Cheers

Koz

Nik Wakelin

unread,
Feb 13, 2007, 6:03:52 PM2/13/07
to WellR...@googlegroups.com
Excellent - and that -e flag on pl_analyze is extra cool.

Cheers Koz.

On 2/14/07, Michael Koziarski <kozi...@gmail.com> wrote:
>

Reply all
Reply to author
Forward
0 new messages