Strange log file behavior

Grant emailgrant at gmail.com
Thu Jul 18 12:48:34 UTC 2013


>> I noticed that most of my rotated nginx log files are empty (0 bytes).
>>
>> My only access_log directive is in nginx.conf:
>>
>> access_log /var/log/nginx/localhost.access_log combined;
>>
>> Also nginx is currently logging to
>> /var/log/nginx/localhost.access_log.1 instead of localhost.access_log.
>>
>> Does anyone know why these things are happening?
>
> This usually happens if someone don't ask nginx to reopen log
> files after a rotation.  See here for details:
>
> http://nginx.org/en/docs/control.html#logs

I tried issuing kill -USR1 `cat /run/nginx.pid` manually but
nginx-1.4.1 still logged to the old file.  I got the following in
error_log:

signal 10 (SIGUSR1) received, reopening logs
reopening logs

It does start logging to the new file if I restart nginx afterward.  I
also noticed this in error_log from when logrotate executes:

open() "/var/log/nginx/error_log" failed (13: Permission denied)
open() "/var/log/nginx/localhost.access_log" failed (13: Permission denied)
open() "/var/log/nginx/localhost.error_log" failed (13: Permission denied)

Is something happening out of order?

- Grant



More information about the nginx mailing list