Limit log size of individual systemd units using log namespaces

For verbose services, I like to limit the maximum log file size of the corresponding systemd units independently, to avoid flushing system messages of other, less verbose services from the journal.

In systemd-journald, this is possible using a log namespace. Add the following to the systemd unit definitions that should be moved to the new namespace, e.g. using systemctl edit:

[Service]
LogNamespace=mylognamespace

And create the corresponding log namespace by creating a configuration file /etc/systemd/journald@mylognamespace.conf, e.g. by copying the main configuration file /etc/systemd/journald.conf.

Make appropriate changes to that file, e.g.

[Journal]
SystemMaxUse=16MB
RuntimeMaxUse=16MB

to limit the size appropriately. Finally, the service can be activated using systemctl enable --now systemd-journald@mylognamespace.