From 5a7fe74d8b683b9d39816dac0049ecb40c89af4b Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Mon, 11 Mar 2024 16:52:54 +0000 Subject: [PATCH] CA-389496: Avoid conflicts when rotating xapi logs The custom logrotation sometimes conflicted with the normal one. Remove the former. Install the xapi logrotate configuration has been moved to be managed as part of the normal logrotation, with the global settings removed. Signed-off-by: Pau Ruiz Safont --- scripts/Makefile | 4 +--- scripts/xapi-logrotate.conf | 17 ----------------- scripts/xapi-logrotate.cron | 3 --- scripts/xapi-logrotate.sh | 13 ------------- 4 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 scripts/xapi-logrotate.cron delete mode 100755 scripts/xapi-logrotate.sh diff --git a/scripts/Makefile b/scripts/Makefile index 17c8e383fac..d2ab8f5d381 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -45,8 +45,7 @@ install: $(IPROG) xapi-health-check $(DESTDIR)$(LIBEXECDIR) $(IPROG) mail-alarm $(DESTDIR)$(LIBEXECDIR) $(IDATA) audit-logrotate $(DESTDIR)/etc/logrotate.d/audit - $(IDATA) xapi-logrotate.conf $(DESTDIR)$(ETCXENDIR) - $(IPROG) xapi-logrotate.sh $(DESTDIR)$(LIBEXECDIR) + $(IDATA) xapi-logrotate.conf $(DESTDIR)/etc/logrotate.d/xapi $(IPROG) xapi-tracing-log-trim.sh $(DESTDIR)$(LIBEXECDIR) $(IPROG) xapi-wait-init-complete $(DESTDIR)$(OPTDIR)/bin $(IPROG) xapi-autostart-vms $(DESTDIR)$(OPTDIR)/bin @@ -158,7 +157,6 @@ install: $(IPROG) certificate-check $(DESTDIR)/etc/cron.daily/ $(IPROG) certificate-refresh $(DESTDIR)/etc/cron.hourly/ mkdir -p $(DESTDIR)/etc/cron.d - $(IDATA) xapi-logrotate.cron $(DESTDIR)/etc/cron.d/xapi-logrotate.cron $(IDATA) xapi-tracing-log-trim.cron $(DESTDIR)/etc/cron.d/xapi-tracing-log-trim.cron mkdir -p $(DESTDIR)/opt/xensource/gpg # templates diff --git a/scripts/xapi-logrotate.conf b/scripts/xapi-logrotate.conf index b50677e72f2..bcee87f738a 100644 --- a/scripts/xapi-logrotate.conf +++ b/scripts/xapi-logrotate.conf @@ -1,20 +1,3 @@ -# see "man logrotate" for details -# rotate log files daily -daily - -# keep one months worth of backlogs -rotate 31 - -# create new (empty) log files after rotating old ones -create - -# compress log files -compress -delaycompress - -# All the general settings above are copied from /etc/logrotate.conf -# as installed by the logrotate RPM. - /var/log/xensource.log { missingok diff --git a/scripts/xapi-logrotate.cron b/scripts/xapi-logrotate.cron deleted file mode 100644 index 3f4506fb1f6..00000000000 --- a/scripts/xapi-logrotate.cron +++ /dev/null @@ -1,3 +0,0 @@ -# Run at 40 minutes past the hour, -# every hour, day-of-month, month, day-of-week -40 * * * * root /opt/xensource/libexec/xapi-logrotate.sh diff --git a/scripts/xapi-logrotate.sh b/scripts/xapi-logrotate.sh deleted file mode 100755 index b4a5935feae..00000000000 --- a/scripts/xapi-logrotate.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# If we're using the old partitioning scheme there's no need to run this. -if ! grep -q /var/log /proc/mounts; then - exit 0 -fi - -/usr/sbin/logrotate /etc/xensource/xapi-logrotate.conf -EXITVALUE=$? -if [ $EXITVALUE != 0 ]; then - /usr/bin/logger -t $0 "ALERT exited abnormally with [$EXITVALUE]" -fi -exit 0