Skip to contentSkip to conversation

sysklogd: enable journal forwarding to syslog.socket

PATCH New [email protected] 1 participant 2 messages Nov 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sysklogd: enable journal forwarding to syslog.socket

From: Etienne Cordonnier <[email protected]>

With systemd, syslogd.service requires syslog.socket and reads the messages that journald forwards to it, which only happens with ForwardToSyslog=yes. Install a journald drop-in enabling it so the daemon keeps working once systemd-conf stops enabling it for every image.

Tested on qemux86-64 with systemd: "logger" messages reach /var/log/messages with the drop-in and are not logged without it.

AI-Generated: Uses Claude Code (claude-sonnet-5-5)

---
 meta/recipes-extended/sysklogd/sysklogd/50-sysklogd.conf | 2 ++
 meta/recipes-extended/sysklogd/sysklogd_2.8.0.bb         | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/sysklogd/sysklogd/50-sysklogd.conf
meta/recipes-extended/sysklogd/sysklogd/50-sysklogd.conf new file +2 -0
new file mode 100644
index 0000000000..29a7331b3c
@@ -0,0 +1,2 @@
+[Journal]
+ForwardToSyslog=yes
meta/recipes-extended/sysklogd/sysklogd_2.8.0.bb +8 -1
index 79e2612653..762bf33504 100644
@@ -12,6 +12,7 @@ inherit update-rc.d update-alternatives systemd autotools
 
 SRC_URI = "git://github.com/troglobit/sysklogd.git;branch=v2.x;protocol=https;tag=v${PV} \
            file://sysklogd \
+           file://50-sysklogd.conf \
            "
 
 SRCREV = "e2c0c1d9585e88b1a85e3634c4dc230517f68f0e"
@@ -23,6 +24,12 @@ do_install:append () {
        install -m 644 ${S}/syslog.conf ${D}${sysconfdir}/syslog.conf
        install -d ${D}${sysconfdir}/init.d
        install -m 755 ${UNPACKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog
+
+       # syslogd.service reads syslog.socket, which journald only feeds
+       # when ForwardToSyslog is enabled.
+       if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+               install -D -m 644 ${UNPACKDIR}/50-sysklogd.conf ${D}${systemd_unitdir}/journald.conf.d/50-sysklogd.conf
+       fi
 }
 
 SYSTEMD_PACKAGES = "${PN}"
@@ -33,7 +40,7 @@ INITSCRIPT_NAME = "syslog"
 CONFFILES:${PN} = "${sysconfdir}/syslog.conf"
 RCONFLICTS:${PN} = "rsyslog busybox-syslog syslog-ng"
 
-FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/sysklogd.conf', '', d)}"
+FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/sysklogd.conf ${systemd_unitdir}/journald.conf.d/50-sysklogd.conf', '', d)}"
 
 ALTERNATIVE_PRIORITY = "100"
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 systemd-conf: stop forwarding journal to syslog by default

From: Etienne Cordonnier <[email protected]>

ForwardToSyslog=yes was added in 2014 (67ddca4a55) as a stopgap because systemd 216 stopped forwarding by default and the oeqa tests then expected a syslog daemon to receive messages. The tests now fall back to journalctl, so the override is no longer needed.

On images without a syslog daemon, journald still formats and tries to forward every message to syslog for nothing, wasting CPU. Images running a syslog daemon that reads /dev/log must now enable ForwardToSyslog themselves.

AI-Generated: Uses Claude Code (claude-sonnet-5-5)

---
 meta/recipes-core/systemd/systemd-conf/journald.conf | 1 -
 1 file changed, 1 deletion(-)
meta/recipes-core/systemd/systemd-conf/journald.conf +0 -1
index fd4d969fa7..750fb2f5e8 100644
@@ -1,3 +1,2 @@
 [Journal]
-ForwardToSyslog=yes
 RuntimeMaxUse=64M
Signature · 1 line
2.43.0