HxHippy
YTTWGH

journalctl

Query the systemd journal (logs)

Overview

Used to query and display messages from the systemd journal. View system logs, filter by time, service, priority, and more.

Syntax

journalctl [OPTIONS...] [MATCHES...]

Common Options

-f, --follow

Show only the most recent journal entries, and follow the journal as new entries are appended.

-n, --lines=N

Show the most recent N journal entries.

-u, --unit=UNIT

Show messages for the specified systemd unit.

-p, --priority=PRIORITY

Filter output by message priorities (emerg, alert, crit, err, warning, notice, info, debug).

--since=DATE

Show entries on or newer than the specified date.

--until=DATE

Show entries on or older than the specified date.

-b, --boot[=ID]

Show messages from a specific boot. Without argument, messages from the current boot are shown.

-k, --dmesg

Show only kernel messages (equivalent to dmesg).

-e, --pager-end

Jump to the end of the journal inside the pager.

-x, --catalog

Augment log lines with explanation texts from the message catalog.

-o, --output=FORMAT

Controls the formatting of journal entries (short, verbose, json, cat).

--no-pager

Do not pipe output into a pager.

Examples

$ journalctl -u nginx

Show all logs for the nginx service.

$ journalctl -u nginx -f

Follow nginx logs in real-time (like tail -f).

$ journalctl -u nginx --since "1 hour ago"

Show nginx logs from the last hour.

$ journalctl -u nginx --since "2024-01-15" --until "2024-01-16"

Show nginx logs for a specific date range.

$ journalctl -p err

Show only error-level messages and above.

$ journalctl -b

Show messages from the current boot.

$ journalctl -b -1

Show messages from the previous boot.

$ journalctl --list-boots

List all available boots in the journal.

$ journalctl -k

Show kernel messages (similar to dmesg).

$ journalctl -n 50

Show the last 50 journal entries.

$ journalctl --disk-usage

Show how much disk space the journal is using.

$ journalctl -o json-pretty -u nginx -n 10

Show last 10 nginx logs in JSON format.

journalctljournallogssystemdsyslogmessagesdebug
/

search

posts, pages, knowledgebase

Search blog posts, pages and every knowledgebase guide, command and tutorial.