[systemd-devel] Systemd service and structured logging

Jérémy ROSEN jeremy.rosen at smile.fr
Mon May 6 09:03:04 UTC 2019


you can have both your app and the wrapper launched by a shell, and have
systemd monitor the shell...

Le lun. 6 mai 2019 à 09:09, Thomas Güttler <guettliml at thomas-guettler.de> a
écrit :

> 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
>


-- 
[image: SMILE]  <http://www.smile.eu/>

20 rue des Jardins
92600 Asnières-sur-Seine
*Jérémy ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: Découvrez l’univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190506/7560ad0a/attachment.html>


More information about the systemd-devel mailing list