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.
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
- rotate logs (i.e. rename old one, optionally create an empty file
with the original name)
- nginx still writes to the (renamed) old file
- kill -USR1
- nginx stops writing to the old file, starts writing to the new one
-
some time passes to finish all the pending writes (maybe even 24h if
you want a single uncompressed log)
-
gzip
Best regards,
Grzegorz N.
On Tue, Jun 10, 2008 at 10:09:57AM +0200, Grzegorz N. wrote:
- nginx still writes to the (renamed) old file
- kill -USR1
- nginx stops writing to the old file, starts writing to the new one
- 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.
On Tue, Jun 10, 2008 at 02:04:30PM +0400, Igor S. wrote:
- 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.
I know 24h is massive overkill but you might want to keep the
uncompressed logs a bit longer for e.g. generating stats or other log
analysis, so you’d be rotating current logs and gzipping/analysing
yesterday’s logs in a single run.
Anyway, it was just an example.
Best regards,
Grzegorz N.