Re: journald not associating log messages with service

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

 



On Sa, 25.07.20 17:22, Ian Pilcher (arequipeno@xxxxxxxxx) wrote:

> I have a simple (non-forking) one-shot service that logs messages via
> syslog.  These messages are not being "associated" with the service
> unit.  I.e., they don't show up if I use journalctl's -u option
> (although they are in the journal).
>
> UPDATE:  I just tried using sd_journal_print, and I'm seeing exactly the
> same behavior.
>
> This is a templated service, if that matters.
>
> Any idea what I can do to get these messages properly associated?

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.

Sucks, and it would be great if the kernel could just send the cgroup
info along...

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

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
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