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 -D reads the journal of another machine from a copied directory

Journalctl
~/tips/tip-journalctl-directory-other-machine

journalctl -D /mnt/backup/var/log/journal -b -1

Reads journal files from any directory, for example a disk taken from a machine that no longer boots.

When a server will not boot, I can still read its logs if I can reach its disk.

-D or --directory= makes journalctl read the journal files in a directory instead of the local ones. Mount the disk of the broken machine on another one, point -D at its /var/log/journal and you read the story from your own desk.

journalctl -D /mnt/backup/var/log/journal -b -1

An empty or in-memory journal on the broken machine leaves nothing to read. Boot offsets such as -b -1 count in the journal you point at, not in your own.

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