Nginx does not re-open log files on SIGUSR1.

Piotr Sikora piotr.sikora at frickle.com
Mon Jan 3 14:38:35 MSK 2011


Hi Piotr,

> I think this is bug, I saw that after logrotate (which on the end 
> running SIGUSR1 on master process) my access log is empty. However if I 
> do SIGHUP it starts working. Looks like Nginx does not re-open logfiles 
> after USR1.
>
> I was able reproduce it multiple times, nginx version 0.8.53, I am not 
> sure if it was working in older versions.

Are you sure that logrotate sends SIGUSR1?
Did you try sending this signal yourself?
How did you verify that logs did not re-open?

Everything works fine with nginx/0.8.53 on my system (OpenBSD):

$ nginx -V 2>&1 | head -1
nginx version: nginx/0.8.53

$ sudo rm -rf /var/log/nginx/*
$ sudo nginx

$ curl localhost >/dev/null 2>&1
$ ls -l /var/log/nginx/
total 8
-rw-r--r--  1 root  wheel  167 Jan  3 11:30 access.log
-rw-r--r--  1 root  wheel  775 Jan  3 11:30 error.log

$ sudo pkill -USR1 nginx

$ curl localhost >/dev/null 2>&1
$ ls -l /var/log/nginx/
total 8
-rw-r--r--  1 _nginx  wheel   334 Jan  3 11:31 access.log
-rw-r--r--  1 _nginx  wheel  1593 Jan  3 11:31 error.log

Best regards,
Piotr Sikora < piotr.sikora at frickle.com >




More information about the nginx mailing list