On Fr, 03.05.19 11:09, Thomas Güttler (guettliml@xxxxxxxxxxxxxxxxxx) 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_journal_sendv() is the API of choice. https://www.freedesktop.org/software/systemd/man/sd_journal_print.html That said, there are other C APIs that speak the same protocol. For example, glib's logging logic will magically use systemd's native logging protocol if it is available. If you use a different programming language, there are bindings for the same protocol for various languages around (including python). > It would be great of systemd could read the string as json. JSON is complex to index properly. systemd supports a simpler "environment-variable-like" format instead. For details see link above. Lennart -- Lennart Poettering, Berlin _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel