Logrotating the log files

Igor Sysoev is at rambler-co.ru
Sat Jan 20 11:07:23 MSK 2007


On Fri, 19 Jan 2007, Jeremy Hubert wrote:

> I'm trying to setup logrotate to automatically rotate the log files every 
> night at midnight.
>
> When they rotate though, nginx doesn't log to the new logfile anymore until I 
> restart the server.. but I'm having a hard time restarting the server from 
> the logrotate config file because of sudo permissions.
>
> So.. any tips? Has anyone else done this?

The rotator should send the -USR1 signal to the master process.
The master process reopens files, does chown() and chmod() to enable
the worker processes to write to files, and send a notification to
the worker procesess. They reopen files instantly.

If the rotator sends the -HUP signal, then them master does a reconfiguration
and starts a new worker processes those write to the new log files, but
the old shuting down worker processes still uses the old log files.

Any way, to send the -USR1 signal you should have the sudo permission.


Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list