TEST-04-JOURNAL: add test case for log filtering through syslog

For issue #38361.
This commit is contained in:
Yu Watanabe
2025-07-28 04:52:37 +09:00
parent b926dda2ef
commit e0b5e14835
3 changed files with 23 additions and 0 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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"