From d79b355188203ae994d6de64d1cc21b34b3d86f0 Mon Sep 17 00:00:00 2001 From: Phil Sphicas Date: Sat, 16 Nov 2019 21:55:46 -0800 Subject: [PATCH] MAAS chart: reduce syslog startup spam When the MAAS syslog pod starts, it polls continuously until the log file exists, generating a message every 10 seconds. However, rsyslogd won't create the file until it receives the first message, which could take a while. This change will create an empty file if none exists prior to starting the rsyslogd service. Previous comments indicate some concerns about a race condition, and it is possible that there are some circumstances when the file may go away and come back, so the polling loop is left in place. Change-Id: Ic56faf718038c5d17ab9353399a94ec74e91f8d0 --- charts/maas/templates/bin/_start-syslog.sh.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/maas/templates/bin/_start-syslog.sh.tpl b/charts/maas/templates/bin/_start-syslog.sh.tpl index 924d9be..bbeff91 100644 --- a/charts/maas/templates/bin/_start-syslog.sh.tpl +++ b/charts/maas/templates/bin/_start-syslog.sh.tpl @@ -19,6 +19,10 @@ RSYSLOG_BIN=${RSYSLOG_BIN:-"/usr/sbin/rsyslogd"} RSYSLOG_CONFFILE=${RSYSLOG_CONFFILE:-"/etc/rsyslog.conf"} LOGFILE=${LOGFILE:-"/var/log/maas/nodeboot.log"} +if [ ! -f "$LOGFILE" ]; then + touch "$LOGFILE" +fi + $RSYSLOG_BIN -f "$RSYSLOG_CONFFILE" # Handle race waiting for rsyslogd to start logging