Spunk Autos

Websites and web tools

Troubleshooting your logging tools

Logs are meant to explain what went wrong, yet they often fail when you need them most. This troubleshooting page works through the usual faults, one symptom at a time, with the checks to run and the fix for each, for anyone running a booking app or shop website on their own server.

Symptom: the error is not in the logs

  1. Check the log level. If production is set to WARN, INFO and DEBUG lines are dropped.
  2. Check where the app writes. Containers usually log to standard output; an app that writes to a file inside the container hides it.
  3. Check that the process can write to the log path; permission errors often fail silently.
  4. Check that errors are caught and logged, not swallowed by an empty catch block.
  5. Check log shipping, if you forward logs, for a full buffer or a wrong address.

Symptom: too much noise to find anything

  • Move routine messages, such as every health check request, to DEBUG.
  • Log one line per request with method, path, status and duration instead of many lines.
  • Use structured logs, for example JSON with fixed field names, so you can filter by field.
  • Sample very frequent events rather than logging every one.

Symptom: timestamps do not line up

When the web server, the app and the database each log in a different time zone, sequences look impossible. Log in UTC everywhere, using an ISO 8601 format with an offset, and convert to local time only when you read. Make sure server clocks are synchronized with NTP.

Symptom: the disk keeps filling

  • Configure rotation by size and age, for example with logrotate or the container runtime's log options.
  • Compress rotated files.
  • Set a retention period that matches how far back you actually investigate.
  • Alert when disk use passes a threshold, well before it is full.

Symptom: personal data in the logs

Customer phone numbers, emails, card details or tokens in logs create a privacy risk and may break data rules. Search a day's logs for patterns such as @ and long digit runs. Mask fields at the logger, never log full request bodies from payment or login forms, and shorten retention for logs that might hold personal data.

Symptom: you cannot follow one request

Generate a request id at the edge, pass it in a header to every service, and include it on every log line. One search for that id then shows the whole story of a failed booking, from the web server to the database.

Quick health check for your logging

CheckHealthy answer
Can you find yesterday's errors in under a minute?Yes, by level and time
Are all timestamps UTC?Yes
Is rotation configured?Yes, with compression
Any secrets or card data in a sample day?None
Can you trace one request end to end?Yes, by request id