[systemd-devel] Changing the Priority Level of Journald during Runtime

Lennart Poettering lennart at poettering.net
Wed Jul 28 15:30:45 UTC 2021


On Mi, 28.07.21 10:02, Andreas Krueger (Andreas.Krueger at fmc-ag.com) wrote:

> Hi Folks,
>
> I'm a programmer who has to realize a dynamic priority level for
> Journald, i.e. the priority level for incoming messages that decide
> whether they are stored in the journal shall be changeable at
> runtime. As far as I know this is not directly supported by
> Journald, I would like to use a trick to accomplish this:
>
> Each time the level is to be changed, the configuration value of
> MaxLevelStore is changed accordingly and Jorunald is restarted by
> command systemctl restart system-journald. Since this will take some
> time, I ask myself, what will happen to messages that arrive during
> this time? Are they gone or buffered and available after the
> restart?

The sockets that journald listens on are allocated outside of
journald, before it is started, via the systemd-journald*.socket unit
files. They also stay up while journald is restarted, and thus any
messages queued in them will remain so. Thus restarting journald
during runtime should be safe and won't lose you any messages.

> Or is a dynamic priority level available in the meantime?

It's not available right now. Please file an RFE issue on github so
that we can look into it. Or provide a patch that adds it.

We nowadays have the Varlink IPC API in journald, it should be pretty
straight-forward adding this logic there.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list