Re: [systemd-devel] Systemd service and structured logging

2019-05-07 Thread Lennart Poettering
On Mo, 06.05.19 12:09, Mantas Mikulėnas (graw...@gmail.com) wrote: > > 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 > > > > On the other hand, JSON parsing might be a useful addition to journald, as > apparent

Re: [systemd-devel] Systemd service and structured logging

2019-05-07 Thread Lennart Poettering
On Mo, 06.05.19 09:12, Thomas Güttler (guettl...@thomas-guettler.de) 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 ba

Re: [systemd-devel] Systemd service and structured logging

2019-05-06 Thread Lennart Poettering
On Fr, 03.05.19 11:09, Thomas Güttler (guettl...@thomas-guettler.de) wrote: > I have a systemd service which is of type "simple". > > I want my service to log key-value pairs. > > Is there a way to use structured logs with systemd? Depend on your programming language. In C, sd_journal_send()/sd_

Re: [systemd-devel] Systemd service and structured logging

2019-05-06 Thread Vincent Dahmen
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: {}" is a quite common syslog format. JSON is meant to be parsed by an application and I am not sure if logging (specially for

Re: [systemd-devel] Systemd service and structured logging

2019-05-06 Thread Mantas Mikulėnas
On Mon, May 6, 2019 at 10:09 AM Thomas Güttler wrote: > 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 > On the other hand, JSON parsing might be a useful addition to journald, as apparently "@cee: {}" is a quite

Re: [systemd-devel] Systemd service and structured logging

2019-05-06 Thread Jérémy ROSEN
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 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

Re: [systemd-devel] Systemd service and structured logging

2019-05-06 Thread Thomas Güttler
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,

Re: [systemd-devel] Systemd service and structured logging

2019-05-03 Thread 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) Automated parsing of stdout is limited, you can * ad

[systemd-devel] Systemd service and structured logging

2019-05-03 Thread Thomas Güttler
I have a systemd service which is of type "simple". I want my service to log key-value pairs. Is there a way to use structured logs with systemd? For example my service writes this to stdout: {"key1": "value1", "key2": 1234} {"key1": "value2", "key2": 5678} ... It would be great of systemd c