Search code examples
linuxloggingkernelsystemdsystemd-journald

Linux journal daemon log and/or persist only the error/critical event logs


With the systemd journal daemon is there a way to configure the persisted logs (/var/log/journal/*) so that only Errors and Critical level events are actually stored to disk?

We have extremely high volume servers that would generated gigabytes daily in just kernel logging but as far as the journal goes we only really care for error/critical events.

I've checked the manpage for /etc/systemd/journald.conf but there doesn't seem to be much there in the way of selecting which level of events persist (Or which levels to ignore in general)

(https://www.freedesktop.org/software/systemd/man/journald.conf.html)


Solution

  • Use MaxLevelStore=crit

    This controls the maximum log level of messages that are stored in the journal. Messages equal or below the log level specified are stored, messages above are dropped. Defaults to "debug".