Pcornel
Linux · Logging

/var/log

Cheat sheet · https://pcornel.dk/topic.php?topic=2822

Back to the Topic

Answer

/var/log holds text log files: syslog or messages (general), auth.log or secure (logins, sudo), kern.log, dmesg, and per-application directories (nginx/, apache2/ or httpd/).

Remember

File names differ by family: Debian uses syslog and auth.log, RHEL messages and secure. Use tail -f to follow and grep/less to search. A full /var/log usually means a log without rotation or a debug level left on.

First checks

  • journalctl -b -p warning — warnings and errors since boot
  • journalctl -u <unit> -f — follow one unit's log
  • ls -lh /var/log — log files and sizes
  • logger -p user.info test — send a test message

Commands

journalctl -b
journalctl --disk-usage

Verify in this order

service or rsyslog writes to a file → logrotate rotates and compresses → old files removed

Where it usually breaks

First mismatch in persistent unit/config/generator → dependency/order graph → systemd state → process/cgroup → socket/resource dependency → journal → consumer check; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2822

Confirmation

Confirm action

Continue?