[systemd-devel] Is /run/systemd/journal/stdout setup protocol stable?
Carl Lei
me at xecycle.info
Fri Jul 19 08:11:29 UTC 2024
Hi all,
Short version of my question is, my program connects to
/run/systemd/journal/stdout and dup2 to stderr; this socket needs that
7-line preamble to actually work. But this seems a hidden internal
thing, so I wonder will this be kept stable? And, does stdout and
stderr have to be different connections?
For more context:
I'm migrating programs to run in kubernetes. My programs already
implement the native journal protocol, so I decided to bind-mount the
host journal socket into containers and keep my logging code; but there
could be libraries/subprograms writing to stderr, so I want these to be
collected too, thus I implemented it this way. Other options I
considered:
- run systemd+journald inside the container, seems too heavy and
requires managing journal storage;
- run a forwarding program, that takes piped log and forward to the
native socket; should be less heavy, but still incurs some overhead,
and I think may have higher risk of losing some logs on exit.
- implement my own "journald" that accepts the same protocol; it would
be very tempting to run this daemon as a DaemonSet inside k8s, but
k8s would not allow me to persist open streams when restarting, so
it has to run inside the host systemd; also this would need
significantly more effort.
Thus my current choice. Am I on the right track?
More information about the systemd-devel
mailing list