[syslog-ng] [PATCH 1/2] scl: Teach the system() source about systemd

Gergely Nagy algernon at balabit.hu
Fri Apr 20 20:00:45 CEST 2012


On Linux, when LISTEN_FDS is non-empty, and
/run/systemd/journal/syslog is a socket, assume we are running under
systemd, in which case our source shall be the journal's syslog
output, instead of the default /dev/log.

Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 scl/system/generate-system-source.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/scl/system/generate-system-source.sh b/scl/system/generate-system-source.sh
index 701e238..708a7a4 100755
--- a/scl/system/generate-system-source.sh
+++ b/scl/system/generate-system-source.sh
@@ -43,8 +43,12 @@ osversion=${UNAME_R:-`uname -r`}
 
 case $os in
 	Linux)
+		DEVLOG="/dev/log"
+		if [ ! -z "$LISTEN_FDS" ] && [ -S "/run/systemd/journal/syslog" ]; then
+			DEVLOG="/run/systemd/journal/syslog"
+		fi
 		cat <<EOF
-unix-dgram("/dev/log");
+unix-dgram("${DEVLOG}");
 file("/proc/kmsg" program-override("kernel") flags(kernel));
 EOF
 		;;
-- 
1.7.9.1




More information about the syslog-ng mailing list