Strange log file behavior

Maxim Dounin mdounin at mdounin.ru
Mon Jul 15 10:36:40 UTC 2013


Hello!

On Mon, Jul 15, 2013 at 02:49:47AM -0700, Grant wrote:

> >> 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 use logrotate:
> 
> /var/log/nginx/*_log {
>         missingok
>         sharedscripts
>         postrotate
>                 test -r /run/nginx.pid && kill -USR1 `cat /run/nginx.pid`
>         endscript
> }
> 
> Does it look OK?

Make sure paths used in postrotate are correct.

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx mailing list