5

To produce metrics on some disks I have setup a systemd.timer + systemd.service

That timer spins up every 10 seconds, and I would like to avoid my journal be spammed every time this small script get spawned and then succedes.

Journal writes multiple lines like that

Jan 04 17:21:31 hostname systemd[1]: personal.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit personal.service has successfully entered the 'dead' state.

Moreover there is an audit on every service start

Jan 04 17:22:31 hostname audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=personal comm="systemd" exe="/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jan 04 17:22:31 hostname kernel: audit: type=1131 audit(1578158551.035:11612): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=personal comm="systemd" exe="/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
4
+50

A good article about this was written by Daniel Aleksandersen

Adjust or silence a systemd service’s logging levels

Override service unit:

systemctl edit Your.service

Add a LogLevelMax parameter.

[Service]
LogLevelMax=2

The standard log levels are emergency (0), alert (1), critical (2), error (3), warning (4), notice (5), info (6), and debug (6). Restart the service:

systemctl daemon-reload
systemctl restart Your.service

Silence standard output

Create a service unit override:

systemctl edit Your.service

Direct the output to null.

[Service]
StandardOutput=null
#StandardError=null

restart the service:

systemctl daemon-reload
systemctl restart Your.service

The service will no longer forward standard output messages to the journal.

For more details on this visit Daniel's blog at the link above and buy him a coffee

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.