I'm particularly interested in this for looking at the output of oneshot services that run on a timer. The --unit flag is close, but it concatenates all the runs of the service together. The most obvious way I can think of would be to filter on PID, but that makes me worry about PID reuse / services that fork, and getting the last PID is pretty inconvenient. Is there some other identifier that corresponds to a single run of a service, that I could use to filter the logs?
EDIT: I would happily accept an authoritative "no" if that's the real answer.
journalctl --user -u UNITFILE -f -o json-prettymight be helpful; you're looking forMESSAGEfields in particular.I found out that you might also need
– karlicoss Jan 24 '20 at 21:52USER_INVOCATION_ID, and also some messages don't have any invocation id attached to them, so can't be filtered through this mechanism. Not sure why, maybe my logging is misconfigured..