From 237b77002c977307a8ea7aad2d61fe97bf379349 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Tue, 25 Jul 2017 14:07:06 -0600 Subject: [PATCH 1/6] syslog-ng: retire PKG_MD5SUM Signed-off-by: Philip Prindeville --- admin/syslog-ng/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/syslog-ng/Makefile b/admin/syslog-ng/Makefile index 0a2c99bf0..47e5cce0f 100644 --- a/admin/syslog-ng/Makefile +++ b/admin/syslog-ng/Makefile @@ -8,7 +8,6 @@ PKG_MAINTAINER:=W. Michael Petullo PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/balabit/syslog-ng/releases/download/$(PKG_NAME)-$(PKG_VERSION)/ -PKG_MD5SUM:=1b48da9ef620cf06e55e481b5abb677a PKG_HASH:=5678856a550ae790618fabde9d1447f932ce7a9080d55dca8fc5df1202c70a17 PKG_INSTALL:=1 From 07a6e8bc7338c4f359a3f9e93b1eea3439d6a4dd Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Tue, 25 Jul 2017 14:10:15 -0600 Subject: [PATCH 2/6] syslog-ng: add customization directory Signed-off-by: Philip Prindeville --- admin/syslog-ng/Makefile | 7 ++++--- admin/syslog-ng/files/custom-logs.conf | 2 -- admin/syslog-ng/files/syslog-ng.conf | 3 ++- 3 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 admin/syslog-ng/files/custom-logs.conf diff --git a/admin/syslog-ng/Makefile b/admin/syslog-ng/Makefile index 47e5cce0f..e294ff577 100644 --- a/admin/syslog-ng/Makefile +++ b/admin/syslog-ng/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=syslog-ng PKG_VERSION:=3.9.1 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=W. Michael Petullo @@ -30,7 +30,8 @@ define Package/syslog-ng/description endef define Package/syslog-ng/conffiles - /etc/syslog-ng.conf +/etc/syslog-ng.conf +/etc/syslog-ng.d/ endef define Build/Configure @@ -68,8 +69,8 @@ define Package/syslog-ng/install install-moduleLTLIBRARIES DESTDIR="$(1)" $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/syslog-ng.init $(1)/etc/init.d/syslog-ng - $(INSTALL_DIR) $(1)/etc $(INSTALL_DATA) ./files/syslog-ng.conf $(1)/etc + $(INSTALL_DIR) $(1)/etc/syslog-ng.d/ $(call libtool_remove_files,$(1)) endef diff --git a/admin/syslog-ng/files/custom-logs.conf b/admin/syslog-ng/files/custom-logs.conf deleted file mode 100644 index 9c8f4413b..000000000 --- a/admin/syslog-ng/files/custom-logs.conf +++ /dev/null @@ -1,2 +0,0 @@ -# place to put customization of logging - diff --git a/admin/syslog-ng/files/syslog-ng.conf b/admin/syslog-ng/files/syslog-ng.conf index 9e09a79e2..cae24a848 100644 --- a/admin/syslog-ng/files/syslog-ng.conf +++ b/admin/syslog-ng/files/syslog-ng.conf @@ -36,5 +36,6 @@ log { destination(messages); }; -@include "/etc/custom-logs.conf" +# put any customization files in this directory +@include "/etc/syslog-ng.d/" From 1923459f4e20731d12c9deb41cdd28c289d0c4a7 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Tue, 25 Jul 2017 14:13:53 -0600 Subject: [PATCH 3/6] syslog-ng: replace hardcoded paths with variables Signed-off-by: Philip Prindeville --- admin/syslog-ng/files/syslog-ng.init | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/admin/syslog-ng/files/syslog-ng.init b/admin/syslog-ng/files/syslog-ng.init index cecb3f904..6036dd900 100644 --- a/admin/syslog-ng/files/syslog-ng.init +++ b/admin/syslog-ng/files/syslog-ng.init @@ -2,18 +2,23 @@ # Copyright (C) 2006-2016 OpenWrt.org START=20 +PROG=/usr/sbin/syslog-ng +PROG2=/usr/sbin/syslog-ng-ctl SERVICE_USE_PID=1 +SERVICE_PID_FILE=/var/log/syslog-ng.pid + +config_file=/etc/syslog-ng.conf start() { - [ -f /etc/syslog-ng.conf ] || return 1 - service_start /usr/sbin/syslog-ng + [ -f $config_file ] || return 1 + service_start $PROG -p $SERVICE_PID_FILE } stop() { - service_stop /usr/sbin/syslog-ng + service_stop $PROG } reload() { - service_reload /usr/sbin/syslog-ng + service_reload $PROG } From 2898e7cc474ce7873374aa84b1b8457ee5f82196 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Tue, 25 Jul 2017 14:15:05 -0600 Subject: [PATCH 4/6] syslog-ng: get rid of guardian process Signed-off-by: Philip Prindeville --- admin/syslog-ng/files/syslog-ng.init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/syslog-ng/files/syslog-ng.init b/admin/syslog-ng/files/syslog-ng.init index 6036dd900..545ca0091 100644 --- a/admin/syslog-ng/files/syslog-ng.init +++ b/admin/syslog-ng/files/syslog-ng.init @@ -12,7 +12,8 @@ config_file=/etc/syslog-ng.conf start() { [ -f $config_file ] || return 1 - service_start $PROG -p $SERVICE_PID_FILE + service_start $PROG --process-mode background \ + -p $SERVICE_PID_FILE } stop() { From 08a13fb27a01219f435241e7b065edf14916f333 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Tue, 25 Jul 2017 14:16:37 -0600 Subject: [PATCH 5/6] syslog-ng: add syntax check to startup script Signed-off-by: Philip Prindeville --- admin/syslog-ng/files/syslog-ng.init | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/admin/syslog-ng/files/syslog-ng.init b/admin/syslog-ng/files/syslog-ng.init index 545ca0091..540a40a4c 100644 --- a/admin/syslog-ng/files/syslog-ng.init +++ b/admin/syslog-ng/files/syslog-ng.init @@ -12,6 +12,12 @@ config_file=/etc/syslog-ng.conf start() { [ -f $config_file ] || return 1 + + if ! $PROG -s 2>/dev/null ; then + echo "Couldn't parse $(basename $config_file)" >&2 + exit 1 + fi + service_start $PROG --process-mode background \ -p $SERVICE_PID_FILE } From 83bd830407a69dedccba1174fca4e8321eab57af Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Tue, 25 Jul 2017 14:17:41 -0600 Subject: [PATCH 6/6] syslog-ng: use syslog-ng-ctl for proper reloads Signed-off-by: Philip Prindeville --- admin/syslog-ng/files/syslog-ng.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/syslog-ng/files/syslog-ng.init b/admin/syslog-ng/files/syslog-ng.init index 540a40a4c..5af9bb47b 100644 --- a/admin/syslog-ng/files/syslog-ng.init +++ b/admin/syslog-ng/files/syslog-ng.init @@ -27,5 +27,5 @@ stop() { } reload() { - service_reload $PROG + $PROG2 reload }