Pcornel
Linux · Logging

Log Troubleshooting

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

Back to the Topic

Answer

Log troubleshooting means finding the right log, narrowing it to the time and source of the problem, and reading the first error rather than the last.

Remember

Note the exact time of the failure and filter to it (--since, --until). The first error often causes the later ones. Check that clocks are synchronised before correlating across hosts. If nothing is logged, raise the log level temporarily.

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 --verify
systemctl restart systemd-journald
journalctl --vacuum-size

Verify in this order

failure time → right log source → filtered window → first error → cause

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=2824

Confirmation

Confirm action

Continue?