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.