diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-05-06 02:27:39 +0300 |
---|---|---|
committer | Andrew Geissler <geissonator@yahoo.com> | 2020-05-06 23:42:32 +0300 |
commit | 9cbd07c15d65014543a5ca8399aa619291f3131a (patch) | |
tree | 5dea6306e5834fb13ad51879181f984a41806b60 /meta-intel/meta-common/recipes-extended | |
parent | 00bb208516f31027771f70eade0698e20dc736e4 (diff) | |
download | openbmc-9cbd07c15d65014543a5ca8399aa619291f3131a.tar.xz |
Change to a script for event log rotation
This changes event log rotation to use a script. The two main
reasons for this change are:
1. systemd logs messages each time the service is started by
the timer.
2. If logrotate returns an error for any reason, the whole
service is marked as failed.
This changes to a single long-running script to:
1. Reduce the log messages for rotation.
2. Print errors instead of failing the service.
Tested:
Filled the IPMI and Redfish logs and confirmed that they are still
correctly rotated.
(From meta-intel rev: b22e8f7fae6b5d028b4c6f5ab9c630018aae0f6e)
Change-Id: I3e12f824d79a0e4e9cf5748538648157f1a6a0cc
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'meta-intel/meta-common/recipes-extended')
4 files changed, 17 insertions, 15 deletions
diff --git a/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service b/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service index fdeefd417..8f3a2bc31 100644 --- a/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service +++ b/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service @@ -1,9 +1,9 @@ [Unit] -Description=Rotates the event logs +Description=Rotate the event logs [Service] -Type=oneshot -ExecStart=/usr/sbin/logrotate /etc/logrotate.d/logrotate.rsyslog +Type=simple +ExecStart=/usr/bin/rotate-event-logs.sh [Install] WantedBy=multi-user.target diff --git a/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.sh b/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.sh new file mode 100644 index 000000000..5a8c5cc10 --- /dev/null +++ b/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +while true; do + sleep 60 + /usr/sbin/logrotate /etc/logrotate.d/logrotate.rsyslog + ec=$? + if [ $ec -ne 0 ] ; then + echo "logrotate failed ($ec)" + fi +done diff --git a/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.timer b/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.timer deleted file mode 100644 index ae1185e4f..000000000 --- a/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Run rotate-event-logs.service every minute - -[Timer] -OnActiveSec=60 -OnUnitActiveSec=60 - -[Install] -WantedBy=timers.target diff --git a/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend b/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend index 7e282804e..c42693787 100644 --- a/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend +++ b/meta-intel/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend @@ -3,7 +3,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += "file://rsyslog.conf \ file://rsyslog.logrotate \ file://rotate-event-logs.service \ - file://rotate-event-logs.timer \ + file://rotate-event-logs.sh \ file://rsyslog-override.conf \ " @@ -13,11 +13,12 @@ PACKAGECONFIG_append = " imjournal" do_install_append() { install -m 0644 ${WORKDIR}/rotate-event-logs.service ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/rotate-event-logs.timer ${D}${systemd_system_unitdir} install -d ${D}${systemd_system_unitdir}/rsyslog.service.d install -m 0644 ${WORKDIR}/rsyslog-override.conf \ ${D}${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/rotate-event-logs.sh ${D}/${bindir}/rotate-event-logs.sh rm ${D}${sysconfdir}/rsyslog.d/imjournal.conf } -SYSTEMD_SERVICE_${PN} += " rotate-event-logs.service rotate-event-logs.timer" +SYSTEMD_SERVICE_${PN} += " rotate-event-logs.service" |