Journalctl - how to restrict search to only certain boot IDs?
It seems like systemd labels every boot with some ID.
Suppose I have some sporadic issue that happens only on some boots. I want to search logs for only the boots that have the issue, not all boots. I don't want to spot check - because the issue is sporadic, it will have to be more systematic.
Suppose I get the boot IDs of interest in some simple format (suppose from https://linux.codidact.com/posts/292100) such as a text file with one ID per line. The list is long and changes often, I don't want to reformat it into a long string of CLI args.
Is there some way to tell journalctl
:
Look only at logs for boots with the IDs from the file boots.txt
?
1 answer
Not directly, no. The argument -b
only accepts a single id and using it multiple times only results in the last one being used.
You can however loop easily over the file and get the output of all consecutive journalctl -b
runs in a single less:
while read BOOTID; do journalctl -b $BOOTID; done < boot.txt |less
0 comment threads