From 51521bf11de3617b6e43557a9a4d9fe908920fcc 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 configuration conflicts for rotating xapi logs The custom logrotation setup for xapi 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. Duplicate settings in the configuration have been removed. Signed-off-by: Pau Ruiz Safont --- scripts/Makefile | 4 +--- scripts/xapi-logrotate.conf | 20 -------------------- scripts/xapi-logrotate.cron | 3 --- scripts/xapi-logrotate.sh | 13 ------------- 4 files changed, 1 insertion(+), 39 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..e9d4845d582 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 @@ -26,9 +9,6 @@ delaycompress # When rotating, remove any rotated logs older than this many days. maxage 31 - # Rotate when file exceeds this size, even if we rotated it today already. - maxsize 100M - # Keep up to this many old files. # (When considering total size, expect a compression factor around 10-20.) rotate 100 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