How to filter journalctl output by process name?
Solution 1:
Just figured this out. You can use any systemd journal field as filter by specifying <FIELD_NAME>=<VALUE>
.
The following fields are useful for this question:
_COMM=, _EXE=, _CMDLINE=
The name, the executable path, and the command line of the process the journal entry originates from.
So in order to filter on the command name, use journalctl -f _COMM=<command-name>
$ journalctl -f _COMM=echo
-- Logs begin at Sat 2018-02-24 12:13:24 CET. --
Jul 25 13:52:26 mycomputer echo[25098]: test
Jul 25 13:56:08 mycomputer myapp[25213]: test