You are not logged in.

#1 2015-08-12 00:59:30

MikeDacre
Member
From: San Francisco Bay Area
Registered: 2013-01-18
Posts: 51
Website

Suppress journalctl entries for timers?

I have a simple timer/service file combination to run a ganglia script.

Timer file:

[Unit]
Description=Run ganglia gmetric for nfs

[Timer]
OnBootSec=5min
OnUnitActiveSec=20s
Unit=gmetric-nfs3.service

[Install]
WantedBy=multi-user.target

Service file:

[Unit]
Description=Run ganglia gmetric for nfs

[Service]
Type=simple
ExecStart=/usr/bin/nfs_stats.pl

This works fine, but my journalctl is now full of the following messages:

Aug 11 17:49:30 fraser-server systemd[1]: Started Run ganglia gmetric for nfs.
Aug 11 17:48:50 fraser-server systemd[1]: Starting Run ganglia gmetric for nfs...
Aug 11 17:48:50 fraser-server systemd[1]: Started Run ganglia gmetric for nfs.
Aug 11 17:48:10 fraser-server systemd[1]: Starting Run ganglia gmetric for nfs...
Aug 11 17:48:10 fraser-server systemd[1]: Started Run ganglia gmetric for nfs.
Aug 11 17:47:30 fraser-server systemd[1]: Starting Run ganglia gmetric for nfs...
Aug 11 17:47:30 fraser-server systemd[1]: Started Run ganglia gmetric for nfs.
Aug 11 17:46:50 fraser-server systemd[1]: Starting Run ganglia gmetric for nfs...
Aug 11 17:46:50 fraser-server systemd[1]: Started Run ganglia gmetric for nfs.
Aug 11 17:46:19 fraser-server systemd[1]: Starting Run ganglia gmetric for nfs...
Aug 11 17:46:19 fraser-server systemd[1]: Started Run ganglia gmetric for nfs.
Aug 11 17:45:57 fraser-server systemd[1]: Starting Run ganglia gmetric for nfs...
Aug 11 17:45:57 fraser-server systemd[1]: Started Run ganglia gmetric for nfs.

That makes sense, but those messages are useless and they clutter the log. Is there any way to suppress them?

Offline

#2 2015-08-15 00:11:17

MikeDacre
Member
From: San Francisco Bay Area
Registered: 2013-01-18
Posts: 51
Website

Re: Suppress journalctl entries for timers?

Does anyone know how to do this? Otherwise I will just have to switch back to crontab.

Should I try posting to another forum?

Offline

#3 2015-08-15 02:05:39

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: Suppress journalctl entries for timers?

MikeDacre wrote:

Does anyone know how to do this? Otherwise I will just have to switch back to crontab.

Should I try posting to another forum?

The issue is not whether you use timers or cron, but journald. One of its design goals is to log _everything_ in one place. You don't get to choose what is logged, only what to see. So, you won't get noise from timers, but get it from crond.

Just using journalctl (w/o arguments) is a wrong thing to do because it will show lots of stuff. A proper way to use journald is to _know_ (journalctl -u ...) what you are looking for, similar to Windows eventlog.

Of course, regardless of how you use journald, you'll have to pay a performance penalty. For instance, on my machine it takes ~30 sec to get an output of journalctl -u smartd.service (and this is 12-core opteron with all journal files in /run/log) just because the box is also a firewall, so iptables log a lot. If that's a problem for you, use syslog-ng/rsyslog.

Hence, the answer to your question is "you can't".


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#4 2015-08-19 20:56:45

MikeDacre
Member
From: San Francisco Bay Area
Registered: 2013-01-18
Posts: 51
Website

Re: Suppress journalctl entries for timers?

Great, thanks Leonid.

That makes sense and I appreciate the philosophy, but I am still a little archaic in my approach to logs. When something goes wrong on the server, I still like being able to do journalctl --since=10:00 --until=13:00 and just look at everything. I do use grep, the unit flag, and even SYSLOG_FACILITY when I am looking more carefully. But for me just looking at everything is nice. So for now I switched that process to being a cron timer instead of a systemd timer.

Thanks for your answer though, I feel like I understand systemd a little better.

Offline

Board footer

Powered by FluxBB