Linux – How to not log some messages in systemd journal

arch linuxsystemdsystemd-journald

Using Archlinux aarch64, I have an error message that keeps happening, which apparently cannot be solved, at least not simply (see this question). Since it occurs very frequently I am concerned about log size, and the storage being a micro-sd card, about its premature wear.

Is there a way to not logs these messages? I see in journald doc it's possible to limit by rate or max size, but I don't see anything for what I want. Ideally it would not filter out the unit completely, since the message is from the kernel.

The error message is always the same, so maybe there's another trick?

Best Answer

From reading man systemd-journald and man journald.conf, I don't see an option for discarding incoming logics, which is possible with or logging daemons like rsyslog.

The workarounds I'm aware of are:

  1. Logging into memory instead of the filesystem-- Set Storage=volatile in journald.conf. The volatility is an obvious tradeoff.
  2. The ability to limit the maximum space consumed by the logs with SystemMaxUse= and RunTimeMaxUse=.

A more extreme workaround is to use the options above to limit the resource consumption by the systemd journal, while also forwarding the logs on to another logging daemon which has a filtering feature.

See man journald.conf for ForwardToSyslog= and other options.

Related Question