Systemd service and structured logging

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

 



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 could read the string as json.

Related question at StackO: https://stackoverflow.com/questions/55806921/systemd-service-and-structured-logging

I see two ways:

V1: my logs get stored in journald as message (as plain string).

V2: my key-value pairs get stored in the journald key-value dictionary.

What do you suggest?

Background: I don't want an ELK stack. I want a simple solution. Since
journald already has key-value pairs for a log entry, why not use it?


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