Log file rotation script

Igor Sysoev is at rambler-co.ru
Tue Jun 10 14:04:30 MSD 2008


On Tue, Jun 10, 2008 at 10:09:57AM +0200, Grzegorz Nosek wrote:

> On pon, cze 09, 2008 at 10:50:04 -0700, Rt Ibmer wrote:
> > > We use logrotate and things work just fine.
> > 
> > Thank you everyone for your input! Using any of the posted techniques, is there any risk of missing a few log entries when under very heavy load? For instance it seems like entries could occur between the time the file is rotated and the time the kill -USR1 executes (split second, but under load this can be multiple transactions)? Is that a real possibility? Thank you again.
> 
> IMO you should be safe if you keep the sequence described in:
> http://wiki.codemongers.com/NginxLogRotation
> 
> 1. rotate logs (i.e. rename old one, optionally create an empty file
> with the original name)
> 
> * nginx still writes to the (renamed) old file
> 
> 2. kill -USR1
> 
> * nginx stops writing to the old file, starts writing to the new one
> 
> 3. some time passes to finish all the pending writes (maybe even 24h if
> you want a single uncompressed log)

No, with nginx you need only to wait second and so.

> 4. gzip


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





More information about the nginx mailing list