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
This commit is contained in:
Phil Sphicas 2019-11-16 21:55:46 -08:00 committed by Phil Sphicas
parent 1147e9689e
commit d79b355188
1 changed files with 4 additions and 0 deletions

View File

@ -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