oetiker / znapzend

zfs backup with remote capabilities and mbuffer integration.
www.znapzend.org
GNU General Public License v3.0
604 stars 136 forks source link

When logging to file, log file is not re-opened upon HUP #587

Closed kusalananda closed 1 year ago

kusalananda commented 1 year ago

When rotating Znapzend log files, I've noticed that Znapzend 0.21.1 keeps the current log file opened for writing, even though the file is renamed and compressed, leading to a corrupt rotated log file and lost log entries.

My current setup is FreeBSD 13.1, which uses newsyslog to manage log file rotations. I'm using the PID file of Znapzend to send the daemonized process a HUP signal when the log file needs to be rotated, but, as mentioned, this does not quite work as expected.

I suggest the daemon should close and re-open the log file when receiving a HUP signal.

kusalananda commented 1 year ago

My alternative is, I guess, to restart the Znapzend service when the log rotates, but since this tends to happen on the hour, I don't know how that would affect Znapzend if it's currently sending snapshots (which also happens on the hour in my setup). I'm afraid of interrupting (or worse, corrupting) the snapshotting+send process.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

kusalananda commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Well, that's one way to handle issues.

oetiker commented 1 year ago

@kusalananda please test the #598

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.