brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl /usr/sbin/sshd shows the logs of one program by its path

Journalctl
~/tips/tip-journalctl-executable-path-match

journalctl -b /usr/sbin/sshd

Filters the journal by a program's file path, which works when you do not know the unit name.

Sometimes I know the program but not the unit that started it. Then I give journalctl the file.

An absolute path is a valid match. For an executable binary journalctl adds an _EXE= match with the canonical path, for a script it matches _COMM= with the script name. Symbolic links are followed first.

journalctl -b /usr/sbin/sshd

The file must exist when you run the query, and you only get entries that carry that field. A program that logs through another process will not show up under its own path.

Further reading: journalctl(1) manual page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile sudo journalctl --setup-keys All Journalctl tips (81) All topics

Link