Journalctl Usage Guide — Reading System Logs and Debugging Services
Informationalsystemd
Overview
Complete guide to using journalctl for reading systemd journal logs, filtering by service, time, priority, and exporting logs for debugging Linux issues.
Key Details
- journalctl reads the systemd journal which collects logs from all systemd services, the kernel, and syslog
- Logs are stored in binary format in /var/log/journal/ and survive reboots (if configured)
- Filtering options: by unit (-u), by time (--since, --until), by priority (-p), by boot (-b)
- Journal can grow large — configure rotation in /etc/systemd/journald.conf
- journalctl -f provides live log streaming similar to tail -f
Common Causes
- Service failures generating error logs that need investigation
- System boot failures leaving diagnostic messages in the journal
- Disk space consumed by unrotated journal files
- Missing logs because journald is configured for volatile storage (RAM only)
Steps
- 1View all logs: journalctl (press Space to page, q to quit)
- 2View specific service: journalctl -u nginx.service -n 100 --no-pager
- 3View since time: journalctl --since '2024-01-15 10:00:00' --until '2024-01-15 12:00:00'
- 4View only errors: journalctl -p err (priorities: emerg, alert, crit, err, warning, notice, info, debug)
- 5View current boot: journalctl -b 0 (previous boot: -b -1)
- 6Follow live logs: journalctl -f -u servicename
- 7Clean old logs: journalctl --vacuum-size=500M or journalctl --vacuum-time=30d
Tags
journalctlsystemdlogsdebuggingjournal
Related Items
More in Systemd
linux-systemd-service-failedLinux systemd Service Failed to Start — Unit Entered Failed State
Errorlinux-systemd-dependency-failedLinux systemd Dependency Failed — Service Cannot Start
Errorlinux-systemd-journal-errorsLinux systemd Journal Errors — Failed Services, Dependencies & Timers
Warninglinux-systemctl-service-errorsSystemctl Service Errors — Failed to Start, Dependency, and Unit File Issues
Errorlinux-systemd-timer-errorsSystemd Timer Errors — Replacing Cron with Systemd Timers and Troubleshooting
WarningFrequently Asked Questions
Create the directory: sudo mkdir -p /var/log/journal and sudo systemctl restart systemd-journald. By default, if /var/log/journal/ exists, logs persist.