2014-02-25 02:13:55 +00:00
|
|
|
# journalctl
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Query the systemd journal.
|
2021-09-02 19:33:49 +01:00
|
|
|
> More information: <https://manned.org/journalctl>.
|
2014-02-25 02:13:55 +00:00
|
|
|
|
2022-06-18 21:55:44 +01:00
|
|
|
- Show all messages with priority level 3 (errors) from this [b]oot:
|
2014-02-25 02:13:55 +00:00
|
|
|
|
2022-06-18 21:55:44 +01:00
|
|
|
`journalctl -b --priority={{3}}`
|
2014-02-25 02:13:55 +00:00
|
|
|
|
2022-06-18 21:55:44 +01:00
|
|
|
- Delete journal logs which are older than 2 days:
|
2020-10-12 22:18:41 +01:00
|
|
|
|
2022-06-18 21:55:44 +01:00
|
|
|
`journalctl --vacuum-time={{2d}}`
|
2020-10-12 22:18:41 +01:00
|
|
|
|
2024-05-03 14:27:33 +01:00
|
|
|
- Show only the last N li[n]es and [f]ollow new messages (like `tail -f` for traditional syslog):
|
2014-02-25 02:13:55 +00:00
|
|
|
|
2024-05-03 14:27:33 +01:00
|
|
|
`journalctl --lines {{N}} --follow`
|
2014-02-25 02:13:55 +00:00
|
|
|
|
2021-05-09 18:54:42 +01:00
|
|
|
- Show all messages by a specific [u]nit:
|
2014-02-25 02:13:55 +00:00
|
|
|
|
|
|
|
`journalctl -u {{unit}}`
|
|
|
|
|
2023-12-29 15:00:45 +00:00
|
|
|
- Show logs for a given unit since the last time it started:
|
|
|
|
|
|
|
|
`journalctl _SYSTEMD_INVOCATION_ID=$(systemctl show --value --property=InvocationID {{unit}})`
|
|
|
|
|
2019-07-31 12:45:03 +01:00
|
|
|
- Filter messages within a time range (either timestamp or placeholders like "yesterday"):
|
|
|
|
|
2019-08-17 05:30:03 +01:00
|
|
|
`journalctl --since {{now|today|yesterday|tomorrow}} --until {{YYYY-MM-DD HH:MM:SS}}`
|
2019-07-31 12:45:03 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Show all messages by a specific process:
|
2014-02-25 02:13:55 +00:00
|
|
|
|
|
|
|
`journalctl _PID={{pid}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Show all messages by a specific executable:
|
2014-02-25 02:13:55 +00:00
|
|
|
|
2018-02-10 14:42:11 +00:00
|
|
|
`journalctl {{path/to/executable}}`
|