Nginx, logrotate and empty files

Posted by user37887 on Server Fault See other posts from Server Fault or by user37887
Published on 2010-03-16T16:42:46Z Indexed on 2010/03/16 16:51 UTC
Read the original article Hit count: 498

Filed under:
|

Hi. I have a problem with nginx/logrotate. The problems is that nginx is logging access to 2 files (main and data).

I have the following contrab setting: 0 * * * * /usr/sbin/logrotate -f /home/orwell/orwell-setup/bin/logrotate-nginx

And the file "logrotate-nginx" has the following content:

/tmp/data.log {
    rotate 90
    daily
    missingok
    notifempty
    size 1
    sharedscripts
    postrotate
        [ ! -f /tmp/nginx.pid ] || kill -USR1 `cat /tmp/nginx.pid`
        MORE THINGS
    endscript
}


/tmp/main.log {
    rotate 90
    daily
    missingok
    notifempty
    size 1
    sharedscripts
    postrotate
        [ ! -f /tmp/nginx.pid ] || kill -USR1 `cat /tmp/nginx.pid`
        MORE THINGS
    endscript
}

The work is done in the two files, but there is a problem that nginx stops logging into those files. Both files are created, but they are empty.

Any ideas why nginx stop logging info to both files?

© Server Fault or respective owner

Related posts about nginx

Related posts about logrotate