[systemd-devel] journald not associating log messages with service
Lennart Poettering
lennart at poettering.net
Tue Jul 28 17:31:50 UTC 2020
On Di, 28.07.20 12:12, Ian Pilcher (arequipeno at gmail.com) wrote:
> On 7/28/20 9:44 AM, Lennart Poettering wrote:
> > Is the service short-lived? There's a race: if a process runs very
> > quickly and logs journald might process the message after the process
> > already exited, i.e. at a time where we can't read the cgroup off the
> > process anymore.
>
> It is indeed a very short-lived "service". (All it does is check a
> few things, write 1 value to a sysfs file, and exit.)
>
> > You can artifically delay your service's exit (sleep 10...) but it's
> > still racy and sucks hard. You could issue the equivalent of
> > "journalctl --sync" at the end of your program...
>
> Is there an API for that?
Yes, but not in v219... That's just ancient, sorry.
On newer version it's a Varlink API.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list