A
cd ..
System

Journalctl Log Viewing

Query and analyze systemd journal logs with journalctl.

2025-09-08
journalctl, logs, linux

View all logs

sudo journalctl

Follow logs (real-time)

sudo journalctl -f

View logs for specific service

sudo journalctl -u nginx

Follow service logs

sudo journalctl -u nginx -f

View logs since boot

sudo journalctl -b

View previous boot logs

sudo journalctl -b -1

Show last N lines

sudo journalctl -n 50

Show logs since specific time

sudo journalctl --since "2024-01-01 10:00:00"

Show logs for last hour

sudo journalctl --since "1 hour ago"

Show logs for today

sudo journalctl --since today

Show logs between times

sudo journalctl --since "2024-01-01" --until "2024-01-02"

Filter by priority (error level)

sudo journalctl -p err

Levels: emerg, alert, crit, err, warning, notice, info, debug

Show kernel messages

sudo journalctl -k

Show logs from specific user

sudo journalctl _UID=1000

Check disk usage

sudo journalctl --disk-usage

Vacuum logs (keep only 100MB)

sudo journalctl --vacuum-size=100M

Vacuum by time (keep only 2 days)

sudo journalctl --vacuum-time=2d

Export logs to file

sudo journalctl -u nginx > nginx-logs.txt

Was this useful?

Share with your team

Browse More