When a Linux service fails or a server slows down, the same routine works almost every time: read the logs, check the four resources, check the network. This guide is that routine.
journalctl – Event Viewer for systemd
Services run by systemd log to the journal:
journalctl -u nginx # all logs for one service
journalctl -u nginx -n 50 # last 50 lines
journalctl -u nginx -f # follow live
journalctl -u nginx --since "1 hour ago"
journalctl -p err -b # errors (and worse) since last boot
journalctl --since "2026-11-29 09:00" --until "2026-11-29 09:30"
journalctl --list-boots # previous boots (did it restart?)
-p priorities run from emerg (0) to debug (7); err includes everything from error up.
Classic log files
Many apps also write to /var/log:
| File (Ubuntu) | What’s in it |
|---|---|
/var/log/syslog |
General system messages |
/var/log/auth.log |
Logins, sudo, SSH (/var/log/secure on RHEL) |
/var/log/apt/history.log |
What was installed or upgraded, and when |
/var/log/nginx/, /var/log/jenkins/ |
App-specific logs |
sudo tail -f /var/log/syslog
sudo grep "Failed password" /var/log/auth.log | tail
zgrep error /var/log/syslog.2.gz # search rotated, compressed logs
logrotate rotates and compresses these automatically – check /etc/logrotate.d/ if a log grows without limit.
Service won’t start: the routine
systemctl status myapp– read the last lines.journalctl -u myapp -n 100 --no-pager– the full error.- Common causes: wrong path in
ExecStart, missing permissions for the service user, port already in use, a typo in a config file. - Many apps can test their config:
nginx -t,apachectl configtest,sshd -t.
The four resources
CPU and load:
uptime # load average for 1, 5, 15 minutes
top # live view (press 1 for per-CPU, M sort by memory, q quit)
ps aux --sort=-%cpu | head
Load average roughly equal to the number of CPU cores = busy but OK. Well above = work is queuing.
Memory:
free -h
ps aux --sort=-%mem | head
Look at the available column, not free – Linux uses spare RAM as disk cache, which is good. Check journalctl -k | grep -i "out of memory" to see whether the kernel killed a process.
Disk:
df -h # space per filesystem
df -i # inodes – you can run out of these with millions of tiny files
sudo du -sh /var/log/* | sort -h | tail # what's using the space
Disk I/O: iostat -x 2 (package sysstat) shows utilisation and wait times.
Network checks
ip a # IP addresses
ip route # default gateway
ss -tulpn # listening ports and the process behind each
curl -I http://localhost:8080 # does the local service answer?
nc -zv db01.contoso.local 5432 # can I reach a remote port?
dig app01.contoso.local # DNS lookup (package dnsutils)
“Address already in use” when a service starts? ss -tulpn | grep :8080 shows who has the port.
Write it down
Like on Windows: note the time, what you saw and what you changed. The journal and log timestamps make it easy to build an accurate incident timeline.
FAQ
The journal is huge – can I limit it?
Yes: sudo journalctl --vacuum-time=14d cleans old entries, and SystemMaxUse= in /etc/systemd/journald.conf sets a permanent limit.
What’s next
Next: Linux networking commands.
LinuxTroubleshootingjournalctlLogsIntermediate