Packages and services

Command journalctl

View systemd logs

Linux · Bash examples · commands run on the selected server

When to use journalctl

Use journalctl to inspect systemd journal records by service or time range. Narrow queries to the relevant incident and account for access restrictions, retention and server timezone when comparing events.

Syntax

journalctl [PARAMETERS]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-u SERVICE
Select messages for a systemd unit.
-n N
Latest N entries.
-f
Follow new log entries.

Usage examples

View service log

journalctl -u nginx -n 100 --no-pager

Recent records for the chosen service are printed without opening a pager.

Follow the log

journalctl -u nginx -f

New records for that service are followed until interrupted.

Select records for the period

journalctl --since '2026-01-01 10:00:00' --until '2026-01-01 11:00:00'

Records within an explicit server-time interval are selected.

Notes and limitations

  • Access to system logs depends on groups and permissions; if necessary, use the authorized sudo.
  • The log may contain personal data and application secrets - please verify the contents before sharing.

Common questions and troubleshooting

Why are expected logs missing?

The service may log elsewhere, journal retention may have removed them, or account permissions may limit visibility. Verify the source and retention policy.

Can I share journal output without review?

Logs can contain user data, addresses and secrets accidentally emitted by applications. Redact sensitive content before sharing diagnostic excerpts.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man journalctl.