journalctl Query the journal
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
journalctl -u <unit>
journalctl -fjournalctl -bjournalctl -p err
journalctl --since "1 hour ago"
journalctl -g <regex>
journalctl -ejournalctl --disk-usage
Concepts
- Journal all entries
- Filters boot, unit, priority
- Time and text narrowed set
- Output pager or stdout
Select entries
journalctl -u <unit>
journalctl -bjournalctl -b -1
journalctl -kjournalctl -t <name>
journalctl -T <name>
journalctl --user-unit <unit>
journalctl -I -u <unit>
journalctl --list-invocations -u <unit>
journalctl _PID=<pid>
journalctl _UID=<uid>
journalctl <path>
journalctl _COMM=<name> + _PID=<pid>
journalctl --user
journalctl -mjournalctl -D <dir>
journalctl --namespace=<ns>
Time and priority
journalctl -p err
journalctl -p warning..err
journalctl --since "<date>"
journalctl --until "<date>"
journalctl -S -1h
journalctl -S today
journalctl --utc
journalctl --facility=<name>
| Name | Number |
|---|---|
emerg |
0 |
alert |
1 |
crit |
2 |
err |
3 |
warning |
4 |
notice |
5 |
info |
6 |
debug |
7 |
Search and follow
journalctl -fjournalctl -f -u <unit>
journalctl -n <num>
journalctl -n +<num>
journalctl -g <regex>
journalctl --case-sensitive -g <regex>
journalctl -ejournalctl -rjournalctl --no-pager
journalctl -xjournalctl -qOutput
journalctl -o json-pretty
journalctl -o json
journalctl -o cat
journalctl -o short-iso
journalctl -o short-precise
journalctl -o verbose
journalctl -o with-unit
journalctl -o export
journalctl --output-fields=<list>
journalctl -ajournalctl --no-hostname
journalctl --show-cursor
journalctl --after-cursor=<cursor>
journalctl --cursor-file=<file>
| Mode | Use |
|---|---|
short |
Default, syslog-like |
cat |
Message text only |
verbose |
All fields |
json-pretty |
Debugging fields |
json |
Scripts and jq |
Fields and boots
journalctl --list-boots
journalctl -b <id>
journalctl -Njournalctl -F <field>
journalctl <FIELD>=<value>
journalctl --header
journalctl --list-catalog
journalctl --list-namespaces
Disk and maintenance
journalctl --disk-usage
sudo journalctl --vacuum-time=<time>
sudo journalctl --vacuum-size=<size>
sudo journalctl --vacuum-files=<num>
sudo journalctl --rotate
sudo journalctl --flush
sudo journalctl --sync
journalctl --verify
sudo journalctl --setup-keys
# /etc/systemd/journald.conf.d/size.conf[Journal]SystemMaxUse=500MMaxRetentionSec=1month# then: sudo systemctl restart systemd-journald
Recipes
systemctl status <unit>journalctl -u <unit> -b -p warning -ejournalctl -I -u <unit> -x
journalctl --list-bootsjournalctl -b -1 -p err --no-pager
journalctl -u <unit> --since yesterday -o short-iso --no-pager > unit.log
journalctl -u <unit> -n 50 -o json --no-pager \ | jq -r '[.__REALTIME_TIMESTAMP, .MESSAGE] | @tsv'



