syslog-ng: fix syslog-ng startup problem with systemd
PATCH 1/1 syslog-ng: fix syslog-ng startup problem with systemd
1. Fix syslog-ng service cannot startup after upgrade to 3.15.1
1) Align path of syslog-ng.conf between syslog-ng@default and do_install in syslog-ng.inc
2) create a default instance for syslog-ng
3) Install default parameter file to /etc/default according
to https://github.com/balabit/syslog-ng/commit /649d1151e79033cc2b81b3353917507266814436
2. Fix "Failed to acquire /run/systemd/journal/syslog socket, disabling systemd-syslog source;" accordint to below content from syslog-ng admin guide.
1) for linux, If the host is running under systemd, syslog-ng OSE reads directly from the systemd journal file using the systemd-journal() source.
2) If possible, use the more reliable systemd-journal() driver instead.
3) The socket activation of systemd is buggy, causing some log messages to get lost during syst
---
.../{syslog-ng.conf => syslog-ng.conf.systemd} | 2 +-
.../{syslog-ng.conf => syslog-ng.conf.sysvinit} | 0
.../syslog-ng.service-the-syslog-ng-service.patch | 3 ++-
meta-oe/recipes-support/syslog-ng/syslog-ng.inc | 23 ++++++++++++++--------
4 files changed, 18 insertions(+), 10 deletions(-)
copy meta-oe/recipes-support/syslog-ng/files/{syslog-ng.conf => syslog-ng.conf.systemd} (99%)
rename meta-oe/recipes-support/syslog-ng/files/{syslog-ng.conf => syslog-ng.conf.sysvinit} (100%)meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf.systemd renamed from meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf +1 -1
@@ -16,7 +16,7 @@ options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no); # This is the default behavior of sysklogd package # Logs may come from unix stream, but not from another machine. # -source s_src { unix-dgram("/dev/log"); internal(); +source s_src { systemd_journal(); internal(); file("/proc/kmsg" program_override("kernel")); };
meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf.sysvinit renamed from meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf +0 -0
meta-oe/recipes-support/syslog-ng/files/syslog-ng.service-the-syslog-ng-service.patch +2 -1
@@ -32,10 +32,11 @@ index 02da288..3a8215d 100644 --- a/contrib/systemd/syslog-ng@default +++ b/contrib/systemd/syslog-ng@default @@ -1,5 +1,5 @@ - CONFIG_FILE=/etc/syslog-ng.conf +-CONFIG_FILE=/etc/syslog-ng.conf -PERSIST_FILE=/var/lib/syslog-ng/syslog-ng.persist -CONTROL_FILE=/var/lib/syslog-ng/syslog-ng.ctl -PID_FILE=/var/run/syslog-ng.pid ++CONFIG_FILE=/etc/syslog-ng/syslog-ng.conf +PERSIST_FILE=@LOCALSTATEDIR@/lib/syslog-ng/syslog-ng.persist +CONTROL_FILE=@LOCALSTATEDIR@/lib/syslog-ng/syslog-ng.ctl +PID_FILE=@LOCALSTATEDIR@/run/syslog-ng.pid
meta-oe/recipes-support/syslog-ng/syslog-ng.inc +15 -8
@@ -16,7 +16,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=24c0c5cb2c83d9f2ab725481e4df5240" DEPENDS = "libpcre flex glib-2.0 openssl util-linux" SRC_URI = "https://github.com/balabit/syslog-ng/releases/download/${BP}/${BP}.tar.gz \ - file://syslog-ng.conf \ + file://syslog-ng.conf.systemd \ + file://syslog-ng.conf.sysvinit \ file://initscript \ file://volatiles.03_syslog-ng \ file://configure.ac-add-option-enable-thread-tls-to-manage-.patch \
@@ -71,7 +72,6 @@ do_configure_prepend() { do_install_append() { install -d ${D}/${sysconfdir}/${BPN} - install ${WORKDIR}/syslog-ng.conf ${D}${sysconfdir}/${BPN}/${BPN}.conf install -d ${D}/${sysconfdir}/init.d install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog install -d ${D}/${sysconfdir}/default/volatiles/
@@ -82,17 +82,24 @@ do_install_append() { # support for systemd if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + install ${WORKDIR}/syslog-ng.conf.systemd ${D}${sysconfdir}/${BPN}/${BPN}.conf + install -d ${D}${systemd_unitdir}/system/ install -m 0644 ${S}/contrib/systemd/${BPN}@.service ${D}${systemd_unitdir}/system/${BPN}@.service - install -m 0644 ${S}/contrib/systemd/${BPN}@default ${D}${systemd_unitdir}/system/${BPN}@default + install -m 0644 ${S}/contrib/systemd/${BPN}@default ${D}${sysconfdir}/default/${BPN}@default + + sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/${BPN}@.service ${D}${sysconfdir}/default/${BPN}@default + sed -i -e 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${systemd_unitdir}/system/${BPN}@.service ${D}${sysconfdir}/default/${BPN}@default + sed -i -e 's,@BASEBINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/${BPN}@.service ${D}${sysconfdir}/default/${BPN}@default - sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/${BPN}@.service ${D}${systemd_unitdir}/system/${BPN}@default - sed -i -e 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${systemd_unitdir}/system/${BPN}@.service ${D}${systemd_unitdir}/system/${BPN}@default - sed -i -e 's,@BASEBINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/${BPN}@.service ${D}${systemd_unitdir}/system/${BPN}@default + install -d ${D}${systemd_unitdir}/system/multi-user.target.wants + ln -sf ../${BPN}@.service ${D}${systemd_unitdir}/system/multi-user.target.wants/${BPN}@default.service + else + install ${WORKDIR}/syslog-ng.conf.sysvinit ${D}${sysconfdir}/${BPN}/${BPN}.conf fi } -FILES_${PN} += "${datadir}/include/scl/ ${datadir}/xsd ${datadir}/tools" +FILES_${PN} += "${datadir}/include/scl/ ${datadir}/xsd ${datadir}/tools ${systemd_unitdir}/system/multi-user.target.wants/*" RDEPENDS_${PN} += "gawk ${@bb.utils.contains('PACKAGECONFIG','json','${PN}-jconf','',d)}" FILES_${PN}-jconf += " \
@@ -124,7 +131,7 @@ RCONFLICTS_${PN} = "busybox-syslog sysklogd rsyslog" RPROVIDES_${PN} += "${PN}-systemd" RREPLACES_${PN} += "${PN}-systemd" RCONFLICTS_${PN} += "${PN}-systemd" -SYSTEMD_SERVICE_${PN} = "${BPN}@default ${BPN}@.service" +SYSTEMD_SERVICE_${PN} = "${BPN}@.service" INITSCRIPT_NAME = "syslog" INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 90 0 1 6 ."
Signature · 1 line
2.7.4