journalctl — reading the systemd journal
cheat sheet · Ubuntu 24.04 · systemd 255 https://lab.dimsanych.ru/en/wiki/journalctl/Cheat sheet
-
journalctl -u nginx -ftail a service's logs -
journalctl -xeu nginxinvestigate a failure -
journalctl -p err -berrors from the current boot -
journalctl -kkernel messages -
journalctl _COMM=sshd -g failby process, plus a text match -
journalctl -b -1the previous boot -
journalctl --vacuum-time=7dclean up
Options
| Flag | Meaning |
|---|---|
-u <unit> |
only this service |
-f / -e |
follow / jump to the end |
-x |
add explanations to messages |
-p <prio> |
this priority or higher: emerg..debug (or err, warning) |
-b [N] |
the current (or Nth) boot |
-k |
kernel messages |
-g RE |
grep the text |
-o <fmt> |
output format: short, json, json-pretty, cat, verbose |
--since/--until |
a time range |
Filtering by structured fields (without naming a service):