Reading /var/log like a sysadmin

by | Nov 18, 2026 | Tutorials | 0 comments

Quick answer

The logs are the server telling you exactly what is wrong.

The logs are the server telling you exactly what is wrong. The skill is knowing which file to open and what pattern to look for.

What you need: Shell access and basic familiarity with grep and tail.

Know the main files

syslog is the catch-all, auth.log holds logins, and each service keeps its own log under /var/log. Start with the one that matches the symptom.

Tail and filter

Use tail -f while reproducing the problem, and pipe through grep to isolate the request, IP, or service you care about.

Ship them somewhere

For a single VPS, logrotate plus a nightly grep of errors is enough. For anything bigger, set up centralized logging before you need it.

tail -f /var/log/syslog | grep --line-buffered 'error'
journalctl -u apache2 -n 200 --no-pager
ls -lh /var/log/

How it works, in detail

The logs are the server telling you what went wrong, and the skill is knowing which file holds the answer. syslog is the catch-all, auth.log records logins and sudo attempts, and each service keeps its own file. Reproducing the problem while tailing the right log turns a mystery into a single line. For anything bigger than one box, centralized logging pays for itself the first time you need to correlate a failure across services instead of SSHing into three machines.

Common pitfalls

  • Watching the wrong file and concluding there is no error.
  • Letting logs fill the disk because logrotate was never checked.

Pro tip

Grep for the timestamp of the failure across all logs, not just the one you suspect.

Read the log before you Google the error. Nine times out of ten the exact message, in context, tells you the fix.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

avatart

About

I’m a System Administrator and a developer with 10+ years of experience.