Re: Systemd service and structured logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 03.05.19 um 13:29 schrieb Jérémy ROSEN:
if you want the whole power of structured logs, you need to use the journald API
I am not sure in what language your program is written, but if you are using C, it's pretty trivial to do
(and i'm pretty sure most bindings are trivial to use too)


Yes, this would work.


Solution 1:
 My service (written Python) uses the journald API.
 Disadvantage: My script can't be run under a different environment (without journald)



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.


The perfect solution is not found yet.

Regards,
  Thomas Güttler


--
Thomas Guettler http://www.thomas-guettler.de/
I am looking for feedback: https://github.com/guettli/programming-guidelines
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux