Log Analysis: Reading System Logs

Use journalctl, dmesg, and /var/log files to diagnose Linux issues — with real examples from one Ubuntu-based migration.

Intermediate Updated 6 min read Tested on Zorin OS 18.1 Pro (Ubuntu 24.04 Noble base) Hardware Lenovo ThinkPad L14 Gen 2

What This Guide Achieves

GoalStatus
Understand where Linux stores logsDone
Read system logs with journalctlDone
Identify common log entries and what they meanDone
Know which logs matter and which to ignoreDone

The Problem (Windows User Perspective)

On Windows, you use Event Viewer to check system logs — but most people never open it. On Linux, logs are text-based and accessible from the terminal. When something goes wrong, logs are the first place to look. The trick is knowing which tool to use and how to filter out the noise.


Where Logs Live

LocationWhat It ContainsHow to Read
journalctlAll system logs (systemd journal)journalctl command
/var/log/syslogGeneral system messagescat /var/log/syslog
/var/log/auth.logAuthentication attempts (login, sudo)cat /var/log/auth.log
/var/log/kern.logKernel messages (hardware, drivers)cat /var/log/kern.log
/var/log/apt/Package manager historycat /var/log/apt/history.log
/var/log/dpkg.logPackage install/remove detailscat /var/log/dpkg.log
dmesgKernel ring buffer (boot + hardware)dmesg or sudo dmesg

Essential journalctl Commands

View Recent Logs

# Last 50 log entries
journalctl -n 50

# Logs from the current boot
journalctl -b

# Logs from the previous boot (useful after a crash)
journalctl -b -1

Filter by Time

# Logs from the last hour
journalctl --since "1 hour ago"

# Logs from today
journalctl --since today

# Logs from a specific time range
journalctl --since "2026-04-12 10:00" --until "2026-04-12 12:00"

Filter by Priority (Severity)

# Only errors and above
journalctl -p err

# Errors and warnings
journalctl -p warning

# Critical and emergency only
journalctl -p crit

Priority levels (from most to least severe):

LevelNameWhat It Means
0emergSystem is unusable
1alertImmediate action required
2critCritical error
3errError — something failed
4warningWarning — not broken, but attention needed
5noticeNormal but significant event
6infoInformational
7debugDebug-level detail

Filter by Service

# Logs from a specific service
journalctl -u auto-cpufreq
journalctl -u thinkfan
journalctl -u NetworkManager
journalctl -u snapd

# Follow logs in real-time (like tail -f)
journalctl -u thinkfan -f

Useful Combinations

# Errors from current boot
journalctl -b -p err

# Errors from last hour, no paging (output to terminal)
journalctl --since "1 hour ago" -p err --no-pager

# Kernel messages from current boot
journalctl -b -k

# Disk-related messages
journalctl -b | grep -i "disk\|nvme\|sda\|sdb"

Using dmesg (Kernel Messages)

dmesg shows kernel-level messages — hardware detection, driver loading, errors:

# All kernel messages (may need sudo)
sudo dmesg

# Last 30 kernel messages
sudo dmesg | tail -30

# Filter for USB events
sudo dmesg | grep -i usb

# Filter for errors
sudo dmesg --level=err,warn

# Clear kernel message buffer (useful for isolating new events)
sudo dmesg -C
# Then plug in a device or trigger an event
sudo dmesg    # Shows only new messages

Real-World Log Analysis Example

From analyzing an actual Zorin OS 18.1 log file, here’s what different entries mean:

Normal / Harmless Entries

Log EntryWhat It MeansAction Needed
wpa_supplicant: signal changeWiFi signal strength fluctuationNone — normal behavior
snapd: Stopping/StartingSnap daemon cyclingNone — normal during snap updates
systemd-timedated: activated/deactivatedTime service responding to queriesNone — normal
systemd-hostnamed: activated/deactivatedHostname service responding to queriesNone — normal
packagekitd: transaction completedPackage manager finished checkingNone — normal
AppArmor: profile replacement for snap-confineSnap security profile updateNone — normal during snap operations

Worth Investigating

Log EntryWhat It MeansWhat to Do
seahorse: Timeout was reachedGNOME Keyring timing out during searchUsually harmless, but if persistent, restart gnome-keyring-daemon
Can't update stage views actorMinor rendering issueUsually harmless — if visual glitches occur, log out/in
Buggy client sent _NET_ACTIVE_WINDOW message with timestamp of 0An app tried to raise its window incorrectlyIdentifies which app is buggy — usually harmless
CPU consumed high timeApp using significant CPUCheck with htop if system feels slow

Needs Attention

Log EntryWhat It MeansWhat to Do
Out of memorySystem ran out of RAMClose apps, check for memory leaks with htop
I/O error on diskDisk read/write failureCheck disk health: sudo smartctl -a /dev/nvme0n1
temperature above thresholdCPU/hardware overheatingCheck fans: sensors, see Fan Guide
segfaultAn application crashedCheck which app crashed, update or reinstall it
failed to start (for a service you need)A system service didn’t startsystemctl status service-name for details

Checking Package History

See what was recently installed or removed:

# Recent apt operations
cat /var/log/apt/history.log | tail -50

# Search for a specific package in history
grep "texlive" /var/log/apt/history.log

# Full dpkg log (every package operation)
grep "install\|remove" /var/log/dpkg.log | tail -30

Quick Diagnostic Workflow

When something goes wrong, follow this order:

  1. Check recent errors:

    journalctl -b -p err --no-pager | tail -30
  2. Check the specific service (if you know which):

    systemctl status service-name
    journalctl -u service-name -n 50
  3. Check kernel messages (for hardware issues):

    sudo dmesg --level=err,warn | tail -20
  4. Check system resource usage:

    htop
    df -h
    free -h
  5. Search logs for a keyword:

    journalctl -b | grep -i "error\|fail\|critical" | tail -30

What Didn’t Work (and Why)

Approach TriedWhy It Failed
Reading /var/log/syslog directly for everythingToo noisy — journalctl with filters is much more useful
Panicking about every warning in logsMost warnings are harmless — focus on err and crit level entries
Using dmesg to find application errorsdmesg only shows kernel messages — use journalctl for app logs
Not using --since or -b filtersWithout filters, journalctl dumps thousands of lines from all boots

Discussion