syslog-ng: bump version header in conf file to 3.10
PATCH 1/2 syslog-ng: bump version header in conf file to 3.10
From: Ricardo Martincoski <[email protected]>
Remove a runtime warning message about configuration file being too old.
Do the same as commit 3dad25466d "syslog-ng: Bump version header in conf file to 3.9". Package version of syslog-ng is 3.10.1, so bump version number in syslog-ng.conf to 3.10.
Also add a comment to avoid the same warning message reappears when the package is bumped.
---
Wrapped version of the warning message that shows at every boot:
Starting syslog-ng daemon: WARNING: Configuration file format is too old, syslog-ng is running in compatibility mode Please update it to use the syslog-ng 3.10 format at your time of convenience, compatibility mode can operate less efficiently in some cases. To upgrade the configuration, please review the warnings about incompatible changes printed by syslog-ng, and once completed change the @version header at the top of the configuration file.;
--- package/syslog-ng/syslog-ng.conf | 2 +- package/syslog-ng/syslog-ng.mk | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
package/syslog-ng/syslog-ng.conf +1 -1
@@ -1,4 +1,4 @@ - at version: 3.9 + at version: 3.10 source s_sys { file("/proc/kmsg" program_override("kernel"));
package/syslog-ng/syslog-ng.mk +2 -0
@@ -4,6 +4,8 @@ # ################################################################################ +# When updating the version, please check at runtime if version at +# syslog-ng.conf header needs to be updated SYSLOG_NG_VERSION = 3.10.1 SYSLOG_NG_SITE = https://github.com/balabit/syslog-ng/releases/download/syslog-ng-$(SYSLOG_NG_VERSION) SYSLOG_NG_LICENSE = LGPL-2.1+ (syslog-ng core), GPL-2.0+ (modules)
Signature · 1 line
2.14.1
PATCH 2/2 support/testing: add test for syslog-ng
From: Ricardo Martincoski <[email protected]>
Check:
- the daemon is started;
- a message is collected;
- the daemon does not issue a warning message on startup.
When the .conf file version does not match the package version a warning message shows up on serial on every boot. This message is generated by syslog-ng before it is running, so it is not logged to /var/log/messages. So in order to test the message is generated, restart the server. It makes the message appears on /var/log/messages (since the server is already running) where its existence can be easily tested using grep.
---
In the current master the test fails (due to the warning message):
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/63969698
With patch 1 applied the test passes:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/63968923
--- .gitlab-ci.yml | 1 + support/testing/tests/package/test_syslog_ng.py | 34 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 support/testing/tests/package/test_syslog_ng.py
.gitlab-ci.yml +1 -0
@@ -300,6 +300,7 @@ tests.package.test_python_cryptography.TestPythonPy2Cryptography: *runtime_test tests.package.test_python_cryptography.TestPythonPy3Cryptography: *runtime_test tests.package.test_rust.TestRust: *runtime_test tests.package.test_rust.TestRustBin: *runtime_test +tests.package.test_syslog_ng.TestSyslogNg: *runtime_test tests.toolchain.test_external.TestExternalToolchainBuildrootMusl: *runtime_test tests.toolchain.test_external.TestExternalToolchainBuildrootuClibc: *runtime_test tests.toolchain.test_external.TestExternalToolchainCCache: *runtime_test
support/testing/tests/package/test_syslog_ng.py new file +34 -0
@@ -0,0 +1,34 @@ +import os + +import infra.basetest + + +class TestSyslogNg(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y + BR2_PACKAGE_SYSLOG_NG=y + BR2_TARGET_ROOTFS_CPIO=y + BR2_TARGET_ROOTFS_TAR is not set + """ + + def test_run(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv5", kernel="builtin", options=["-initrd", cpio_file]) + self.emulator.login() + + cmd = "grep syslog-ng /var/log/messages | grep starting" + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + + cmd = "logger my-message;" + cmd += "sleep 1;" + cmd += "grep my-message /var/log/messages" + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + + cmd = "syslog-ng-ctl reload;" + cmd += "sleep 1;" + cmd += "grep syslog-ng /var/log/messages | grep -i warning" + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 1)
Signature · 1 line
2.14.1
PATCH 2/2 support/testing: add test for syslog-ng
Hello,
Quoted 15 lines · Ricardo Martincoski
From: Ricardo Martincoski <[email protected]>
Check:
- the daemon is started;
- a message is collected;
- the daemon does not issue a warning message on startup.When the .conf file version does not match the package version a warning message shows up on serial on every boot. This message is generated by syslog-ng before it is running, so it is not logged to
/var/log/messages. So in order to test the message is generated, restart the server. It makes the message appears on/var/log/messages(since the server is already running) where its existence can be easily tested using grep.
Quoted 1 line
Signed-off-by Ricardo Martincoski <[email protected]>
Thanks, I've applied. Some comments/suggestions below, though.
support/testing/tests/package/test_syslog_ng.py line 20
Quoted 6 lines
support/testing/tests/package/test_syslog_ng.py new file +6
-0+ def test_run(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv5", kernel="builtin", options=["-initrd", cpio_file]) + self.emulator.login() + + cmd = "grep syslog-ng /var/log/messages | grep starting"
Why a double grep, and not a single grep like:
grep "syslog-ng.*starting"
or some better regexp ?
support/testing/tests/package/test_syslog_ng.py line 26
Quoted 6 lines
support/testing/tests/package/test_syslog_ng.py new file +6
-0+ _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + + cmd = "logger my-message;" + cmd += "sleep 1;" + cmd += "grep my-message /var/log/messages"
Maybe && between each command would be better ?
support/testing/tests/package/test_syslog_ng.py line 32
Quoted 6 lines
support/testing/tests/package/test_syslog_ng.py new file +6
-0+ _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + + cmd = "syslog-ng-ctl reload;" + cmd += "sleep 1;" + cmd += "grep syslog-ng /var/log/messages | grep -i warning"
Ditto single grep command ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Thomas Petazzoni
AppliedPATCH 1/2 syslog-ng: bump version header in conf file to 3.10
In reply to Ricardo MartincoskiHello,
Quoted 8 lines · Ricardo Martincoski
From: Ricardo Martincoski <[email protected]>
Remove a runtime warning message about configuration file being too old.
Do the same as commit
3dad25466d"syslog-ng: Bump version header in conf file to 3.9". Package version of syslog-ng is 3.10.1, so bump version number in syslog-ng.conf to 3.10.
Quoted 5 lines
Also add a comment to avoid the same warning message reappears when the package is bumped.
Signed-off-by Ricardo Martincoski <[email protected]>Cc Chris Packham <[email protected]>
I've applied, thanks. A suggestion below, though.
package/syslog-ng/syslog-ng.conf line 1
Quoted 7 lines
package/syslog-ng/syslog-ng.conf +1
-1@@ -1,4 +1,4 @@ - at version: 3.9 + at version: 3.10
Why don't we replace this by:
@version: VERSION_MAJOR
package/syslog-ng/syslog-ng.conf line 4
Quoted 3 lines
package/syslog-ng/syslog-ng.conf +2
-0+# When updating the version, please check at runtime if version at +# syslog-ng.conf header needs to be updated SYSLOG_NG_VERSION = 3.10.1
And then:
SYSLOG_NG_VERSION_MAJOR = 3.10SYSLOG_NG_VERSION = $(SYSLOG_NG_VERSION_MAJOR).1
and do some $(SED) logic when installing syslog-ng.conf ?
This would avoid the need to manually sync this stupid version number :-)
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/2 syslog-ng: bump version header in conf file to 3.10
Quoted 38 lines · Thomas Petazzoni,
Hello,
Quoted 8 lines · Ricardo Martincoski
From: Ricardo Martincoski <[email protected]>
Remove a runtime warning message about configuration file being too old.
Do the same as commit
3dad25466d"syslog-ng: Bump version header in conf file to 3.9". Package version of syslog-ng is 3.10.1, so bump version number in syslog-ng.conf to 3.10.Quoted 5 lines
Also add a comment to avoid the same warning message reappears when the package is bumped.
Signed-off-by Ricardo Martincoski <[email protected]>Cc Chris Packham <[email protected]>I've applied, thanks. A suggestion below, though.
Review
Quoted 1 line
(quoted diff) +0
-0
b/package/syslog-ng/syslog-ng.confpackage/syslog-ng/syslog-ng.conf line 1
Quoted 6 lines
index
a3384eebc3..e767255d71100644package/syslog-ng/syslog-ng.conf +1
-1@@ -1,4 +1,4 @@ - at version: 3.9 + at version: 3.10Why don't we replace this by:
@version:
VERSION_MAJORpackage/syslog-ng/syslog-ng.conf line 4
Quoted 3 lines
package/syslog-ng/syslog-ng.conf +2
-0+# When updating the version, please check at runtime if version at +# syslog-ng.conf header needs to be updated SYSLOG_NG_VERSION = 3.10.1And then:
Quoted 8 lines
SYSLOG_NG_VERSION_MAJOR= 3.10SYSLOG_NG_VERSION= $(SYSLOG_NG_VERSION_MAJOR).1and do some $(SED) logic when installing syslog-ng.conf ?
This would avoid the need to manually sync this stupid version number :-)
That'd work until there is an actual meaningful change in syntax.
Ideally syslog-ng would have a separate config version number. Even then the default buildroot syslog-ng is so simple that it's more than likely it won't be affected by most syntax changes. Last time I looked there wasn't a simple enough default config in the syslog-ng repo that could just be used without enabling optional features.
Realistically anyone wanting to use syslog-ng in anger will want to supply
their own config file(s), possibly with a local commit rebased on top of a buildroot release. My only concern would be that the sed thing masks the
real error from such users. Given that buildroot has other mechanisms for customising the root fs and no-one has asked for a "don't install the
default syslog-ng.conf" option I'm guessing that such a user doesn't yet
exist. If/when such a user appears we can tweak the seding to suit. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180420/79bf9eee/attachment.html>
PATCH 1/2 syslog-ng: bump version header in conf file to 3.10
In reply to Ricardo MartincoskiQuoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Ricardo" == Ricardo Martincoski <[email protected]> writes:
From: Ricardo Martincoski <[email protected]> Remove a runtime warning message about configuration file being too old.
Do the same as commit
3dad25466d"syslog-ng: Bump version header in conf file to 3.9". Package version of syslog-ng is 3.10.1, so bump version number in syslog-ng.conf to 3.10.Also add a comment to avoid the same warning message reappears when the package is bumped.
Signed-off-by Ricardo Martincoski <[email protected]>Cc Chris Packham <[email protected]>
Quoted 9 lines
---
Wrapped version of the warning message that shows at every boot:
Starting syslog-ng daemon: WARNING: Configuration file format is too old, syslog-ng is running in compatibility mode Please update it to use the syslog-ng 3.10 format at your time of convenience, compatibility mode can operate less efficiently in some cases. To upgrade the configuration, please review the warnings about incompatible changes printed by syslog-ng, and once completed change the @version header at the top of the configuration file.;
Committed to 2018.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard