1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
From: =?utf-8?q?Ferenc_W=C3=A1gner?= <ferenc.wagner@balabit.com>
Date: Sun, 15 Jan 2023 11:44:31 +0100
Subject: Revert "logrotate: Use copytruncate method by default"
This reverts commit 04362046c4a9d7307feb5b68341d567b7d0b94d6.
The copytruncate documentation says that it should not be used to avoid
losing logging data. The drawbacks mentioned in the reverted commit are
not relevant, because they involve hiding problems which should be fixed
at their respective origins instead.
---
conf/logrotate/Makefile.am | 7 +++++++
conf/logrotate/corosync-reopen.in | 5 -----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/conf/logrotate/Makefile.am b/conf/logrotate/Makefile.am
index 35efa2d..4f7b753 100644
--- a/conf/logrotate/Makefile.am
+++ b/conf/logrotate/Makefile.am
@@ -34,9 +34,16 @@ MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = corosync-reopen.in corosync-copytruncate.in
+if HAVE_QB_LOG_FILE_REOPEN
+corosync: corosync-reopen.in
+ $(SED) -e 's#@''LOGDIR@#${LOGDIR}#g' \
+ -e 's#@''SBINDIR@#$(sbindir)#g' \
+ $< > $@
+else
corosync: corosync-copytruncate.in
$(SED) -e 's#@''LOGDIR@#${LOGDIR}#g' \
$< > $@
+endif
logrotatecorosyncdir = ${LOGROTATEDIR}
logrotatecorosync_DATA = corosync
diff --git a/conf/logrotate/corosync-reopen.in b/conf/logrotate/corosync-reopen.in
index 730fb74..839c5da 100644
--- a/conf/logrotate/corosync-reopen.in
+++ b/conf/logrotate/corosync-reopen.in
@@ -1,8 +1,3 @@
-# This logrotate method has two main problems and it's kept only for reference:
-# 1. It does fail when corosync is not running (solvable by adding "|| true")
-# 2. If (for some reason) cfgtool -L fails, logrotate fails and corosync keeps
-# logging into old file. Added "|| true" makes situation even worse
-# because logrotate removes file but corosync keeps logging into it.
@LOGDIR@/corosync.log {
missingok
compress
|