Skip to contentSkip to conversation

syslog/syslog-lib.sh: Match rsyslog config written by RainerScript

PATCH New Xiao Yang 2 participants 2 messages Oct 11, 2018 – Oct 12, 2018

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 syslog/syslog-lib.sh: Match rsyslog config written by RainerScript

Since rsyslog commit 3b55048094d759adf8162f0829f239e115ebf2c0, rsyslog by default deletes log socket during restart, unless socket is provided by systemd.

If default rsyslog config written by RainerScript uses imjournal module (e.g. module(load="imjournal"...) and doesn't specify $SystemLogSocketName, syslog-lib.sh cannot match imjournal module and just write imuxsock module into the rsyslog.conf constructed by test. In this case, "/dev/log" is owned by journald but rsyslog deletes it as its default log socket after testing.

---
 testcases/kernel/syscalls/syslog/syslog-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/syslog/syslog-lib.sh +1 -1
index 35c13da..30c797a 100755
@@ -71,7 +71,7 @@ setup()
 		CONFIG_FILE="/etc/syslog-ng/syslog-ng.conf"
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
-		if grep -q -r '^\$ModLoad[[:space:]]*imjournal' /etc/rsyslog.conf /etc/rsyslog.d/ ; then
+		if grep -qri '^[^#].*load.*imjournal' /etc/rsyslog.conf /etc/rsyslog.d/ ; then
 			systemd_journal=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r /etc/rsyslog.conf /etc/rsyslog.d/)
 			RSYSLOG_CONFIG=$(cat <<EOF
 $systemd_journal
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 syslog/syslog-lib.sh: Match rsyslog config written by RainerScript

----- Original Message -----

Quoted 4 lines

Since rsyslog commit 3b55048094d759adf8162f0829f239e115ebf2c0, rsyslog by default deletes log socket during restart, unless socket is provided by systemd.

Quoted 8 lines

If default rsyslog config written by RainerScript uses imjournal module (e.g. module(load="imjournal"...) and doesn't specify $SystemLogSocketName, syslog-lib.sh cannot match imjournal module and just write imuxsock module into the rsyslog.conf constructed by test. In this case, "/dev/log" is owned by journald but rsyslog deletes it as its default log socket after testing.

Pushed with added comment what patterns is the grep targetting.

Thanks,
Jan