On Mo, 06.05.19 09:12, Thomas Güttler (guettliml@xxxxxxxxxxxxxxxxxx) wrote: > Solution 1: > My service (written Python) uses the journald API. > Disadvantage: My script can't be run under a different environment > (without journald) Doesn't Python have an abstraction for that that does some basic structured logging and is able to fallback to classic text-only logging if that's not available? > Solution 2: > I let my service write json to stdout and a wrapper collects these lines and the wrapper uses the journald API. > Disadvantage: Systemd is monitoring the wrapper, not the real service. Signal handling for stopping and restarting > is not direct from systemd to service. Note that JSON is considerably more complex than the simply text key/value pairs the journal consumes. Moreover, for the journal we have a vocabulary of common log fields defined, not sure how that would translate either way to json... Note that "journalctl -o json" may be used to convert journal logging to json, but there's no approach for the reverse, since it's not clear how to map thta. As mentioned, the simpler key/value logic of the journal is chosen on purpose, so that we can relatively straight-forwardly index by these fields, which is not obvious when you consume full json. Lennart -- Lennart Poettering, Berlin _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel