Intermediate
Package: systemd
journalctl
Query and follow the systemd journal.
Syntax
journalctl [options]
Description
journalctl reads the structured log maintained by systemd-journald, and can filter by service, time range, priority or boot, replacing the need to grep through multiple flat log files on modern distributions.
Examples
journalctl -u nginx
Show logs for a specific systemd service
journalctl -f
Follow new log entries live, like tail -f
journalctl --since "1 hour ago"
Show logs from a relative time window
journalctl -p err -b
Show only error-priority messages from the current boot
Only available on systemd-based distributions; Alpine (OpenRC) uses plain files under /var/log instead.
Applies to
Put it into practice