[systemd-devel] Systemd service and structured logging

Vincent Dahmen wahrwolf at wolfpit.net
Mon May 6 10:23:35 UTC 2019

Hi there,
I wrote my first response not to the list, so sry for the double.

> On the other hand, JSON parsing might be a useful addition to journald, as
> apparently "@cee: {<jsondict>}" is a quite common syslog format.
JSON is meant to be parsed by an application and I am not sure if
logging (specially for humans) is the way to go here...

> I would suggest implementing support for multiple logging backends – don't
> call journald APIs directly and don't print out JSON directly, but have
> abstract functions such as log_info(text, **kvpairs) or something such.
> That's what many programs already do for file/syslog/journal backends.
> (Possibly just use the `logging` module in python?)
I would highly suggest to use that module.
There is even a ready to go logger[0] for journald available.


[0] https://stackoverflow.com/questions/34588421/how-to-log-to-journald-systemd-via-python
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190506/cb5811c6/attachment-0001.sig>

More information about the systemd-devel mailing list