Log file rotation script
Grzegorz Nosek
grzegorz.nosek at gmail.com
Tue Jun 10 12:09:57 MSD 2008
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)
4. gzip
Best regards,
Grzegorz Nosek
More information about the nginx
mailing list