problem with split log

dika andika at agrakom.com
Thu Mar 13 10:03:47 MSK 2008


Hi there,

Unfortunately nginx doesn't support piping log method inside it's config 
script, so you have to set it separately.
try this:

~ point your access/error log to a file, such as /logs/access.log/ and 
/logs/error.log/
~ if /logs/access.log/ and /logs/error.log/ has been exist, delete them, 
and recreate as fifo's
~ /mkfifo logs/access.log logs/error.log/
~ make a .sh files to put a cronolog script and piping, like:

#!/bin/bash

|(cat /usr/local/nginx/logs/access.log |/usr/local/sbin/cronolog -l /var/log/nginx/access.log \
/var/log/nginx/%Y/%m/%d/%H/access.log) &
(cat /usr/local/nginx/logs/error.log |/usr/local/sbin/cronolog -l /var/log/nginx/error.log \
/var/log/nginx/%Y/%m/%d/%H/error.log) &|

~ start/execute thus file whenever you start your nginx

Source and references:
http://pjkh.com/articles/nginx-chronolog.html

rgrds,
Andika
*INDONESIAN*

Corey Donohoe wrote:
> We use that logrotate config on like 1500+ linux instances.  It
> works... really.  I too have been burned by various things wrt log
> rotation, but nginx shows nothing but love. ;)
>
> On 3/12/08, Dave Cheney <dave at cheney.net> wrote:
>   
>> Meh - i've had logrotate screw up on my too many times and delete a
>>  log file that things are logging into.
>>
>>
>>  On 13/03/2008, at 2:46 PM, Corey Donohoe wrote:
>>
>>  > Yo,
>>  >
>>  > We do something like this at Engine Yard.
>>  >
>>  > Daily nginx logrotation during non-peak hours:
>>  >
>>  > http://pastebin.com/f400c3e0e
>>  >
>>  > Daily log migration to a drive with more space:
>>  >
>>  > http://pastebin.com/f6bc64e94
>>  >
>>  > On 3/12/08, Dave Cheney <dave at cheney.net> wrote:
>>  >> Try something like this
>>  >>
>>  >
>>  >
>>  > --
>>  > Corey Donohoe
>>  > http://www.atmos.org/
>>  > http://www.engineyard.com/
>>  >
>>
>>
>>
>>     
>
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080313/01bfddf7/attachment.html>


More information about the nginx mailing list