]> git.proxmox.com Git - proxmox-backup.git/commit
log rotate: do NOT compress first rotation
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 20 Oct 2020 08:26:28 +0000 (10:26 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 20 Oct 2020 09:09:17 +0000 (11:09 +0200)
commit9e870b5f398c9831ebedd17ad82e1fc1da2c04c1
tree772d6664b5a31b6e07387e247e98253f475ee205
parent7827e3b93e1eeccb8cdecd59ce690699c6bba2fa
log rotate: do NOT compress first rotation

The first rotation is normally the one still opened by one or more
processes for writing, so it must NOT be replaced, removed, ..., as
this then makes the remaining logging, until those processes are
noticed that they should reopen the logfile due to rotation, goes
into nirvana, which is far from ideal for a log.

Only rotating (renaming) is OK for this active file, as this does not
invalidates the file and keeps open FDs intact.

So start compressing with the second rotation, which should be clear
to use, as all writers must have been told to reopen the log during
the last rotation, reopen is a fast operation and normally triggered
at least day ago (at least if one did not dropped the state file
manually), so we are fine to archive that one for real.
If we plan to allow faster rotation the whole rotation+reopen should
be locked, so that we can guarantee that all writers switched over,
but this is unlikely to be needed.

Again, this is was logrotate sanely does by default since forever.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/tools/logrotate.rs