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: a lone + in journalctl combines two matches with OR

Journalctl
~/tips/tip-journalctl-plus-or-matches

journalctl -b _SYSTEMD_UNIT=ssh.service + _COMM=sudo

Combines two journal matches with OR instead of AND, so one command shows two sources together.

Every filter you add normally narrows the output. The plus sign is the one word that widens it again.

Matches on different fields are combined with AND by default, and two matches on the same field are combined with OR. A + written as its own word turns everything before and after it into an OR. The command below shows the SSH service and anything run by sudo in one stream, in time order.

journalctl -b _SYSTEMD_UNIT=ssh.service + _COMM=sudo

The plus needs spaces around it, and options such as -b still apply to both sides as an extra AND. The field names, _SYSTEMD_UNIT and _COMM here, are listed on the systemd.journal-fields page.

Further reading: journalctl(1) manual page, systemd.journal-fields(7) 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