Pcornel
Observability · Logs

Log Levels and Retention

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

Back to the Topic

Answer

Log levels (DEBUG, INFO, WARN, ERROR, FATAL) mark severity; retention decides how long logs are kept, often by level, source and compliance requirements.

Remember

Production at INFO; enable DEBUG temporarily. ERROR should mean someone may need to act. Retain security/audit logs longer than debug logs, and delete personal data per policy.

First checks

  • sum by (level)(count_over_time({app="api"}[1h])) — first check for this topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool check config prometheus.yml — config valid

Verify in this order

event severity → level → retention policy → deletion

Where it usually breaks

Logging every request at info on a busy service creates huge volume.

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

Confirmation

Confirm action

Continue?