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 --root reads the logs of a system mounted under a directory

Journalctl
~/tips/tip-journalctl-root-offline-system

journalctl --root=/mnt/system -b -1

Reads the journal of another system that is mounted under a directory, such as a rescue mount.

A mounted disk image or a chroot has the whole log hierarchy inside, and --root understands it.

--root= makes journalctl look for journal files under that directory, using run/journal and var/log/journal inside it. You do not have to type the full path to the journal. The directory can also hold the catalog for -x.

journalctl --root=/mnt/system -b -1

It reads what was written to disk, so a system with logs in memory only leaves nothing behind. For a disk image file there is --image= in systemd 247 and newer.

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