[systemd-devel] journal entries for most recent pid?

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Apr 24 07:31:08 PDT 2014


On Thu, Apr 24, 2014 at 04:15:43PM +0200, Lennart Poettering wrote:
> On Thu, 24.04.14 15:08, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> 
> > 
> > On Thu, Apr 24, 2014 at 08:59:46AM +0200, Lennart Poettering wrote:
> > > On Tue, 25.03.14 15:59, Peter Hutterer (peter.hutterer at who-t.net) wrote:
> > > 
> > > > I can't seem to find this in the documentation, so I do wonder if it exists:
> > > > is there an equivalent to journalctl -b -1 that lists the log of the most
> > > > recent pid?
> > > > 
> > > > Specifically I'd like to run journalctl /usr/bin/Xorg --pid -1 or similar to
> > > > get users to attach the most recent log file instead of having to provide
> > > > _PID manually.
> > > 
> > > Hmm, I can see the usecase for that, but I am not sure how we could
> > > implement this nicely...
> > > 
> > > To implement this we'd have to store the starttime of each PID in the
> > > database, and then order by that. And then we'd have to figure out the
> > > most recent one, probably in a similar fashion as we already allow this
> > > boot ids...
> > > 
> > > I have added this now to the TODO list, but don't hold your breath...
> > I've been thinking about this too, and actually for the same usecase (i.e.
> > logs from X). I think we should teach various programs like X to logs an
> > equivalent of _BOOT_ID (e.g. "XORG_RUN_ID"), and then systemctl could be
> > extended to support it the same -b / --list-boots, except that the
> > user would specify the tag (e.g. XORG_RUN_ID) to sort on. The
> > advantage would be that e.g. Xorg and gdm could agree to use the same
> > tag for the same session, thus making is easy to correlate log
> > messages.
> 
> Hmm, such an XORG_RUN_ID would be pretty close to _SYSTEMD_SESSION=
> then, no?
Yeah, but _SYSTEMD_SESSION repeats... It would be useful to have a randomized
tag too. _SYSTEMD_SESSION_ID?

Zbyszek


More information about the systemd-devel mailing list