Prevent systemd messages for each connection

hi All,

Recently I started using the systemd socket files (in stead of the xinetd version) for the listener for the check_mk agent on port 6556.

Effectively this works great, however for every connection from the server, two log-lines are printed in the journal and syslog file:

Dec 14 20:49:29 XXXX systemd[1]: Starting Check_MK (192.168.X.Y:57378)…
Dec 14 20:49:31 XXXX systemd[1]: Started Check_MK (192.168.X.Y:57378).

I have tried several things to stop logging these lines, but not succesfull sofar. Obviously I don’t want to stop other syslogging.

One of the options I tried was adding this to ‘/etc/systemd/system/check_mk@.service’

StandardError=null
StandardOutput=null
Using ‘StandardOutput=null’ results in no output at all, so the agent does not work anymore.

Does anybody have a clue how we can prevent al these (useless) lines in the syslog?

Best regards,

Ronald

Hello Ronald,

I think the message comes from systemd itself, so changing the log settings of the service doesn’t help.
Don’t know whether this can be configured in systemd.

Regards
Racke

Hi Racke,

Thanks for the response. It is indeed a systemd ‘issue’, however, this one seems difficult to tackle without affecting other systemd logging.

I will keep on searching for a good way to disable systemd logging for a specific service, but sofar I did not find a solution. If anybody has a brilliant idea here ??

Best regards,

Ron

Depending on your syslog setup, you could configure your syslog daemon to ignore the messages in question for the syslog output.

To filter the journald messages try to add a drop-in and restrict the log level. Run systemctl edit check_mk@.service. An editor will open. Enter

[Service]
LogLevelMax=err

and save the file (don’t change its name; the default name is perfectly valid).
Then run

systemctl daemon-reload

to activate the changes.

In case you are unfamiliar with drop-ins: If systemd finds a unit file, say /etc/systemd/system/foo.service and a directory /etc/systemd/system/foo.service.d/ exists, then all *.conf files in that specific subdirectory are added to the orginal unit file.

This way you can tweak the behaviour of systemd units without editing the original file (as that would be overwritten by an update of the application).

See here for details on the LogLevelMax setting and here for drop-ins.

I’m not sure if the syslog filtering is even neccessary once the journald filtering is in effect. Just try the journald filtering first.

Regards
Dirk

1 Like

Hi Dirk,

Many thanks for the response.

I have attempted your suggestions (focused on systemd for now), however adding either ‘LogLevelMax’ into a drop-in, or directly in the service definition file, does not stop the messages being logged.
Changes were followed by ‘systemctl daemon-reload’ and a restart of the ‘check_mk.socket’.

systemctl status check_mk@.127.0.0.1

● check_mk@.127.0.0.1.service - Check_MK

Loaded: loaded (/etc/systemd/system/check_mk@.service; static; vendor preset: enabled)

Drop-In: /etc/systemd/system/check_mk@.service.d

       └─override.conf

Active: inactive (dead)

During my attempts I have kept ‘journalctl -f’ open to see the effects.

Interestingly increasing the LogLevelMax to ‘debug’ also does not make a difference, while I would expect more chatty messages.

I have also attempted to add this into the socket file (isof the .service’ file), also without results.
Also using ‘Sysloglevel’ does not make a difference.

This is really an interesting issue to keep systemd from logging these messages…

Dec 22 11:13:57 wise systemd[1]: Starting Check_MK (127.0.0.1:56796)…
Dec 22 11:14:01 wise systemd[1]: Started Check_MK (127.0.0.1:56796).

Best regards,

Ronald

1 Like

Hi Ronald (@acfnews)

yes, I tried it just out. Same behaviour as you describe. Apparently the

[Service]
LogLevelMax=err

setting only applies to messages emitted by check_mk@.service itself.
The started and stopped messages appear to be emitted by systemd which isn’t affected by the settings in the check_mk@.service file.

Bad luck :frowning: However, it was worth a try.

Regards,
Dirk