From: Yu Watanabe Date: Sun, 27 Jul 2025 19:52:37 +0000 (+0900) Subject: TEST-04-JOURNAL: add test case for log filtering through syslog X-Git-Tag: v258-rc2~61^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0b5e148352955b0441e2dd134ccab1b8432bd73;p=thirdparty%2Fsystemd.git TEST-04-JOURNAL: add test case for log filtering through syslog For issue #38361. --- diff --git a/test/integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering-syslog.py b/test/integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering-syslog.py new file mode 100755 index 00000000000..e1d3ad7c116 --- /dev/null +++ b/test/integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering-syslog.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: LGPL-2.1-or-later + +import subprocess +import syslog + +if __name__ == '__main__': + syslog.openlog(ident="logs-filtering", logoption=syslog.LOG_PID) + syslog.syslog(syslog.LOG_NOTICE, "Logging from the service, and ~more~ foo bar") + + subprocess.check_output( + ['journalctl', '--sync'], + stdin=subprocess.DEVNULL, + text=True) diff --git a/test/integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering-syslog.service b/test/integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering-syslog.service new file mode 100644 index 00000000000..02ace637088 --- /dev/null +++ b/test/integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering-syslog.service @@ -0,0 +1,8 @@ +[Unit] +Description=Log filtering unit + +[Service] +Type=oneshot +ExecStart=/usr/lib/systemd/tests/testdata/TEST-04-JOURNAL.units/logs-filtering-syslog.py +SyslogLevel=notice +LogLevelMax=info diff --git a/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh b/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh index 16a94bf934e..87c78f0af59 100755 --- a/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh +++ b/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh @@ -119,6 +119,7 @@ test_delegate() { } test_service logs-filtering.service +test_service logs-filtering-syslog.service test_delegate delegated-cgroup-filtering.service systemctl log-level "$SAVED_LOG_LEVEL"