Skip to contentSkip to conversation

syslog-ng: New package

PATCH Superseded Chris Packham 2 participants 6 messages Oct 14, 2015 – Oct 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 syslog-ng: New package

syslog-ng is an enhanced log daemon, supporting a wide range of input and output methods: syslog, unstructured text, queueing, SQL & NoSQL.

---
Changes since v1:
- add hash file
- use simplified logging configuration for buildroot
- don't install man pages

 package/Config.in                |  3 +++
 package/syslog-ng/Config.in      | 18 +++++++++++++
 package/syslog-ng/S01logging     | 36 ++++++++++++++++++++++++++
 package/syslog-ng/syslog-ng.conf | 16 ++++++++++++
 package/syslog-ng/syslog-ng.hash |  2 ++
 package/syslog-ng/syslog-ng.mk   | 55 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 130 insertions(+)
 create mode 100644 package/syslog-ng/Config.in
 create mode 100644 package/syslog-ng/S01logging
 create mode 100644 package/syslog-ng/syslog-ng.conf
 create mode 100644 package/syslog-ng/syslog-ng.hash
 create mode 100644 package/syslog-ng/syslog-ng.mk
package/Config.in +3 -0
index 8e3c64a..e191af7 100644
@@ -1518,6 +1518,9 @@ endif
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/sysklogd/Config.in"
 endif
+if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	source "package/syslog-ng/Config.in"
+endif
 	source "package/systemd/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/sysvinit/Config.in"
package/syslog-ng/Config.in new file +18 -0
new file mode 100644
index 0000000..185a8e2
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_SYSLOG_NG
+	bool "syslog-ng"
+	select BR2_PACKAGE_EVENTLOG
+	select BR2_PACKAGE_LIBGLIB2
+	select BR2_PACKAGE_PCRE
+	select BR2_PACKAGE_OPENSSL
+	depends on BR2_USE_WCHAR # glib2
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU # fork()
+	help
+	  syslog-ng is an enhanced log daemon, supporting a wide range of input
+	  and output methods: syslog, unstructured text, queueing, SQL & NoSQL
+
+	  https://syslog-ng.org/
+
+comment "syslog-ng needs a toolchain w/ wchar, threads"
+	depends on BR2_USE_MMU
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
package/syslog-ng/S01logging new file +36 -0
new file mode 100644
index 0000000..3fa7107
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+start() {
+  echo -n "Starting syslog-ng daemon: "
+  start-stop-daemon -S -q -p /var/run/syslog-ng.pid --exec /usr/sbin/syslog-ng
+  [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+stop() {
+  echo -n "Stopping syslog-ng daemon: "
+  start-stop-daemon -K -q -p /var/run/syslog-ng.pid
+  [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+restart() {
+  stop
+  sleep 1
+  start
+}
+
+case "$1" in
+  start)
+    start
+    ;;
+  stop)
+    stop
+    ;;
+  restart|reload)
+    restart
+    ;;
+  *)
+    echo "Usage: $0 {start|stop|restart}"
+    exit 1
+esac
+
+exit $?
package/syslog-ng/syslog-ng.conf new file +16 -0
new file mode 100644
index 0000000..0b4a860
@@ -0,0 +1,16 @@
+ at version: 3.7
+
+source s_sys {
+	file("/proc/kmsg" program_override("kernel"));
+	unix-stream ("/dev/log");
+	internal();
+};
+
+destination d_all {
+	file("/var/log/messages");
+};
+
+log {
+	source(s_sys);
+	destination(d_all);
+};
package/syslog-ng/syslog-ng.hash new file +2 -0
new file mode 100644
index 0000000..761ac84
@@ -0,0 +1,2 @@
+# Locally computed
+sha1 494418ca185d912e2296dccac4ca1b38924159ff syslog-ng-3.7.1.tar.gz
package/syslog-ng/syslog-ng.mk new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.5.3
#1 lore raw

PATCH v2 1/1 syslog-ng: New package

Dear Chris Packham,

Thanks for this new version, a few comments below.

package/Config.in endif · line 1523

Quoted 11 lines · Chris Packham
package/Config.in +3 -0
index 8e3c64a..e191af7 100644
@@ -1518,6 +1518,9 @@ endif
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/sysklogd/Config.in"
 endif
+if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	source "package/syslog-ng/Config.in"
+endif

You can probably group is with the BR2_PACKAGE_BUSYBOX_SHOW_OTHERS used for sysklogd.

package/syslog-ng/S01logging line 4

Quoted 10 lines
package/syslog-ng/S01logging new file +4 -0
new file mode 100644
index 0000000..3fa7107
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+start() {
+  echo -n "Starting syslog-ng daemon: "

Indentation should be done with one tab in the init script.

And use "printf" here rather than "echo -n". We changed this in all init scripts about a week ago or so. The reasoning is that printf is POSIX, while echo -n is specific to certain shells only.

package/syslog-ng/S01logging line 6

Quoted 2 lines
package/syslog-ng/S01logging new file +2 -0
+  start-stop-daemon -S -q -p /var/run/syslog-ng.pid --exec /usr/sbin/syslog-ng
+  [ $? = 0 ] && echo "OK" || echo "FAIL"

Using echo here is fine.

package/syslog-ng/S01logging line 8

Quoted 2 lines
package/syslog-ng/S01logging new file +2 -0
+# Locally computed
+sha1 494418ca185d912e2296dccac4ca1b38924159ff syslog-ng-3.7.1.tar.gz

If it's locally computed, use a sha256.

package/syslog-ng/S01logging line 12

Quoted 4 lines
package/syslog-ng/S01logging new file +4 -0
+SYSLOG_NG_VERSION = 3.7.1
+SYSLOG_NG_SOURCE = syslog-ng-$(SYSLOG_NG_VERSION).tar.gz
+SYSLOG_NG_SITE = https://github.com/balabit/syslog-ng/releases/download/syslog-ng-$(SYSLOG_NG_VERSION)
+SYSLOG_NG_LICENSE = LGPL (syslog-ng core), GPL (modules)

Please indicate the version of the license (GPLv2, GPLv2+, GPLv3, GPLv3+, etc.).

package/syslog-ng/S01logging line 19

Quoted 7 lines
package/syslog-ng/S01logging new file +7 -0
+SYSLOG_NG_LICENSE_FILES = COPYING
+SYSLOG_NG_DEPENDENCIES = host-bison host-flex host-pkgconf \
+	eventlog libglib2 openssl pcre \
+	$(if $(BR2_PACKAGE_PYTHON),python) \
+	$(if $(BR2_PACKAGE_PYTHON3),python3) \
+	$(if $(BR2_PACKAGE_LIBESMTP),libesmtp) \
+	$(if $(BR2_PACKAGE_JSON_C),json-c)

When there are autoconf options associated to certain optional dependencies, we generally prefer to have them handled in one block like this:

ifeq ($(BR2_PACKAGE_LIBESTMP),y)
SYSLOG_NG_DEPENDENCIES += libesmtp
SYSLOG_NG_CONF_OPTS += --enable-<something>
else
SYSLOG_NG_CONF_OPTS += --disable-<something>
endif

Quoted 9 lines
package/syslog-ng/S01logging new file +9 -0
+SYSLOG_NG_CONF_OPTS = --disable-manpages
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+SYSLOG_NG_CONF_OPTS += \
+	--enable-systemd \
+	--with-systemdsystemunitdir=/usr/lib/systemd/system
+SYSLOG_NG_DEPENDENCIES += systemd
+else
+SYSLOG_NG_CONF_OPTS += --disable-systemd

package/syslog-ng/S01logging

Quoted 10 lines
package/syslog-ng/S01logging new file +10 -0
+endif
+
+define SYSLOG_NG_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/syslog-ng/S01logging \
+		$(TARGET_DIR)/etc/init.d/S01logging
+endef
+
+ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),)
+SYSLOG_NG_CONF_OPTS += --disable-python --without-python
+endif

See above: don't only disable when not available, but also explicitly enable when available.

package/syslog-ng/S01logging

Quoted 3 lines
package/syslog-ng/S01logging new file +3 -0
+ifeq ($(BR2_PACKAGE_LIBESMTP),)
+SYSLOG_NG_CONF_OPTS += --disable-smtp
+endif

Ditto.

package/syslog-ng/S01logging

Quoted 4 lines
package/syslog-ng/S01logging new file +4 -0
+
+ifeq ($(BR2_PACKAGE_JSON_C),)
+SYSLOG_NG_CONF_OPTS += --disable-json
+endif

Ditto.

package/syslog-ng/S01logging

Quoted 3 lines
package/syslog-ng/S01logging new file +3 -0
+define SYSLOG_NG_FIXUP_CONFIG
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		DESTDIR=$(TARGET_DIR) scl-uninstall-local

This seems a bit weird. What needs to be uninstalled ?

package/syslog-ng/S01logging

Quoted 7 lines
package/syslog-ng/S01logging new file +7 -0
+	$(INSTALL) -D -m 0644 package/syslog-ng/syslog-ng.conf \
+		$(TARGET_DIR)/etc/syslog-ng.conf
+endef
+
+SYSLOG_NG_POST_INSTALL_TARGET_HOOKS = SYSLOG_NG_FIXUP_CONFIG
+
+$(eval $(autotools-package))

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 syslog-ng: New package

Quoted 49 lines · Thomas Petazzoni

Dear Chris Packham,

Thanks for this new version, a few comments below.

package/Config.in endif · line 1523

Quoted 11 lines · Chris Packham
package/Config.in +3 -0
index 8e3c64a..e191af7 100644
@@ -1518,6 +1518,9 @@ endif
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
      source "package/sysklogd/Config.in"
 endif
+if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+     source "package/syslog-ng/Config.in"
+endif

You can probably group is with the BR2_PACKAGE_BUSYBOX_SHOW_OTHERS used for sysklogd.

package/syslog-ng/S01logging line 4

Quoted 10 lines
package/syslog-ng/S01logging new file +4 -0
new file mode 100644
index 0000000..3fa7107
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+start() {
+  echo -n "Starting syslog-ng daemon: "

Indentation should be done with one tab in the init script.

And use "printf" here rather than "echo -n". We changed this in all init scripts about a week ago or so. The reasoning is that printf is POSIX, while echo -n is specific to certain shells only.

package/syslog-ng/S01logging line 6

Quoted 2 lines
package/syslog-ng/S01logging new file +2 -0
+  start-stop-daemon -S -q -p /var/run/syslog-ng.pid --exec /usr/sbin/syslog-ng
+  [ $? = 0 ] && echo "OK" || echo "FAIL"

Using echo here is fine.

package/syslog-ng/S01logging line 8

Quoted 2 lines
package/syslog-ng/S01logging new file +2 -0
+# Locally computed
+sha1 494418ca185d912e2296dccac4ca1b38924159ff syslog-ng-3.7.1.tar.gz

If it's locally computed, use a sha256.

Quoted 7 lines

package/syslog-ng/S01logging line 12

Quoted 4 lines
package/syslog-ng/S01logging new file +4 -0
+SYSLOG_NG_VERSION = 3.7.1
+SYSLOG_NG_SOURCE = syslog-ng-$(SYSLOG_NG_VERSION).tar.gz
+SYSLOG_NG_SITE = https://github.com/balabit/syslog-ng/releases/download/syslog-ng-$(SYSLOG_NG_VERSION)
+SYSLOG_NG_LICENSE = LGPL (syslog-ng core), GPL (modules)

Please indicate the version of the license (GPLv2, GPLv2+, GPLv3, GPLv3+, etc.).

Will do.

Quoted 13 lines

package/syslog-ng/S01logging line 19

Quoted 8 lines
package/syslog-ng/S01logging new file +7 -0
+SYSLOG_NG_LICENSE_FILES = COPYING
+SYSLOG_NG_DEPENDENCIES = host-bison host-flex host-pkgconf \
+     eventlog libglib2 openssl pcre \
+     $(if $(BR2_PACKAGE_PYTHON),python) \
+     $(if $(BR2_PACKAGE_PYTHON3),python3) \
+     $(if $(BR2_PACKAGE_LIBESMTP),libesmtp) \
+     $(if $(BR2_PACKAGE_JSON_C),json-c)

When there are autoconf options associated to certain optional dependencies, we generally prefer to have them handled in one block like this:

Quoted 7 lines

ifeq ($(BR2_PACKAGE_LIBESTMP),y)
SYSLOG_NG_DEPENDENCIES += libesmtp
SYSLOG_NG_CONF_OPTS += --enable-<something>
else
SYSLOG_NG_CONF_OPTS += --disable-<something>
endif

Noted.

Quoted 36 lines
Quoted 9 lines
package/syslog-ng/S01logging new file +9 -0
+SYSLOG_NG_CONF_OPTS = --disable-manpages
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+SYSLOG_NG_CONF_OPTS += \
+     --enable-systemd \
+     --with-systemdsystemunitdir=/usr/lib/systemd/system
+SYSLOG_NG_DEPENDENCIES += systemd
+else
+SYSLOG_NG_CONF_OPTS += --disable-systemd

package/syslog-ng/S01logging

Quoted 10 lines
package/syslog-ng/S01logging new file +10 -0
+endif
+
+define SYSLOG_NG_INSTALL_INIT_SYSV
+     $(INSTALL) -m 0755 -D package/syslog-ng/S01logging \
+             $(TARGET_DIR)/etc/init.d/S01logging
+endef
+
+ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),)
+SYSLOG_NG_CONF_OPTS += --disable-python --without-python
+endif

See above: don't only disable when not available, but also explicitly enable when available.

package/syslog-ng/S01logging

Quoted 3 lines
package/syslog-ng/S01logging new file +3 -0
+ifeq ($(BR2_PACKAGE_LIBESMTP),)
+SYSLOG_NG_CONF_OPTS += --disable-smtp
+endif

Ditto.

package/syslog-ng/S01logging

Quoted 4 lines
package/syslog-ng/S01logging new file +4 -0
+
+ifeq ($(BR2_PACKAGE_JSON_C),)
+SYSLOG_NG_CONF_OPTS += --disable-json
+endif

Ditto.

Quoted 5 lines

package/syslog-ng/S01logging

Quoted 3 lines
package/syslog-ng/S01logging new file +3 -0
+define SYSLOG_NG_FIXUP_CONFIG
+     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+             DESTDIR=$(TARGET_DIR) scl-uninstall-local

This seems a bit weird. What needs to be uninstalled ?

There are a bunch of configuration files installed by default. Some of which rely on "optional" features (json was the one that stopped syslog-ng from starting). Technically since I'm installing a custom config file they won't do any harm but then they're just sitting there in the file system doing nothing.

Quoted 16 lines

package/syslog-ng/S01logging

Quoted 8 lines
package/syslog-ng/S01logging new file +7 -0
+     $(INSTALL) -D -m 0644 package/syslog-ng/syslog-ng.conf \
+             $(TARGET_DIR)/etc/syslog-ng.conf
+endef
+
+SYSLOG_NG_POST_INSTALL_TARGET_HOOKS = SYSLOG_NG_FIXUP_CONFIG
+
+$(eval $(autotools-package))

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

#3 lore raw

PATCH v2 1/1 syslog-ng: New package

Dear Chris Packham,

Quoted 7 lines · Chris Packham
Quoted 1 line

This seems a bit weird. What needs to be uninstalled ?

There are a bunch of configuration files installed by default. Some of which rely on "optional" features (json was the one that stopped syslog-ng from starting). Technically since I'm installing a custom config file they won't do any harm but then they're just sitting there in the file system doing nothing.

OK. Can you simply copy/paste this explanation in a comment above the fixup commands?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v3 1/1 syslog-ng: New package

syslog-ng is an enhanced log daemon, supporting a wide range of input and output methods: syslog, unstructured text, queueing, SQL & NoSQL.

---
Changes since v1:
- add hash file
- use simplified logging configuration for buildroot
- don't install man pages

Changes since v2:
- incorporate review feedback from Thomas

 package/Config.in                |  1 +
 package/syslog-ng/Config.in      | 18 ++++++++++
 package/syslog-ng/S01logging     | 36 +++++++++++++++++++
 package/syslog-ng/syslog-ng.conf | 16 +++++++++
 package/syslog-ng/syslog-ng.hash |  2 ++
 package/syslog-ng/syslog-ng.mk   | 75 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 148 insertions(+)
 create mode 100644 package/syslog-ng/Config.in
 create mode 100644 package/syslog-ng/S01logging
 create mode 100644 package/syslog-ng/syslog-ng.conf
 create mode 100644 package/syslog-ng/syslog-ng.hash
 create mode 100644 package/syslog-ng/syslog-ng.mk
package/Config.in +1 -0
index 8e3c64a..325a381 100644
@@ -1517,6 +1517,7 @@ endif
 	source "package/swupdate/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/sysklogd/Config.in"
+	source "package/syslog-ng/Config.in"
 endif
 	source "package/systemd/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/syslog-ng/Config.in new file +18 -0
new file mode 100644
index 0000000..185a8e2
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_SYSLOG_NG
+	bool "syslog-ng"
+	select BR2_PACKAGE_EVENTLOG
+	select BR2_PACKAGE_LIBGLIB2
+	select BR2_PACKAGE_PCRE
+	select BR2_PACKAGE_OPENSSL
+	depends on BR2_USE_WCHAR # glib2
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU # fork()
+	help
+	  syslog-ng is an enhanced log daemon, supporting a wide range of input
+	  and output methods: syslog, unstructured text, queueing, SQL & NoSQL
+
+	  https://syslog-ng.org/
+
+comment "syslog-ng needs a toolchain w/ wchar, threads"
+	depends on BR2_USE_MMU
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
package/syslog-ng/S01logging new file +36 -0
new file mode 100644
index 0000000..cb5127a
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+start() {
+	printf "Starting syslog-ng daemon: "
+	start-stop-daemon -S -q -p /var/run/syslog-ng.pid --exec /usr/sbin/syslog-ng
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+stop() {
+	printf "Stopping syslog-ng daemon: "
+	start-stop-daemon -K -q -p /var/run/syslog-ng.pid
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+restart() {
+	stop
+	sleep 1
+	start
+}
+
+case "$1" in
+	start)
+		start
+		;;
+	stop)
+		stop
+		;;
+	restart|reload)
+		restart
+		;;
+	*)
+		echo "Usage: $0 {start|stop|restart}"
+		exit 1
+esac
+
+exit $?
package/syslog-ng/syslog-ng.conf new file +16 -0
new file mode 100644
index 0000000..0b4a860
@@ -0,0 +1,16 @@
+ at version: 3.7
+
+source s_sys {
+	file("/proc/kmsg" program_override("kernel"));
+	unix-stream ("/dev/log");
+	internal();
+};
+
+destination d_all {
+	file("/var/log/messages");
+};
+
+log {
+	source(s_sys);
+	destination(d_all);
+};
package/syslog-ng/syslog-ng.hash new file +2 -0
new file mode 100644
index 0000000..56dc75f
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 4c19841b9079b377cd814b1e6ebbf273af41d04d51c648f4c31f19bfadc20220  syslog-ng-3.7.1.tar.gz
package/syslog-ng/syslog-ng.mk new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.5.3
#5 lore raw

PATCH v3 1/1 syslog-ng: New package

Dear Chris Packham,

Quoted 9 lines · Chris Packham

syslog-ng is an enhanced log daemon, supporting a wide range of input and output methods: syslog, unstructured text, queueing, SQL & NoSQL.

---
Changes since v1:
- add hash file
- use simplified logging configuration for buildroot
- don't install man pages

Applied with a number of changes:

[Thomas:
- Rewrap Config.in.help text
- Pass --pidfile option when starting syslog-ng so that its PID file is created in /var/run/syslog-ng.pid, which allows start-stop-daemon to actually stop syslog-ng. Without this, S01logging was not able to stop syslog-ng.
- Pass the executable path at stop time in S01logging, so that start-stop-daemon can check we're not incorrectly stopping something completely different.
- Add busybox as a dependency of syslog-ng if busybox is enabled, since we want to override Busybox's S01logging init script.
- Simplify the python condition, since python and python3 are mutually exclusive.
- Rewrap the comment above SYSLOG_NG_FIXUP_CONFIG.]

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com