2 messages in ru.sysoev.nginxRe: Solution to get cronolog working...
FromSent OnAttachments
Philip HallstromMar 15, 2007 1:42 pm 
Igor SysoevMar 16, 2007 3:00 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Solution to get cronolog working...Actions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Mar 16, 2007 3:00:59 am
List:ru.sysoev.nginx

On Thu, Mar 15, 2007 at 01:43:15PM -0700, Philip Hallstrom wrote:

I recently setup nginx and had to get cronolog working. I noticed someone else asked about this a little while ago and I figured I'd write up what I did in case someone else wants the same thing.

In a nutshell, I used fifo's. More here:

http://blog.pjkh.com/articles/2007/03/15/nginx-and-cronolog

Hope folks find it useful.

You may decrease context switches number using:

-(cat /usr/local/nginx/logs/access.log | /usr/local/sbin/cronolog ... +/usr/local/sbin/cronolog ... <

Anyway I do not think that using cronolog is useful. You may avoid a lot of unnecessary context switches, data copies, and possible nginx worker processes blocking using simple script run by cron every hour:

-------------- TIME=`date +%Y/%m/%d/%H` # FreeBSD date command, other OSes may use # different switches

mv /var/log/nginx/access.log /var/log/nginx/${TIME}/access.log mv /var/log/nginx/error.log /var/log/nginx/${TIME}/error.log

kill -USR1 `cat /var/run/nginx.pid`

It's simplest.