Logging Standard
Logging Standard
Non-Negotiables
- Logs are production tooling. If you can’t debug with them, they are wrong.
- Structured logs only. Free-text dumps don’t scale.
- No secrets. Ever. Credentials in logs are security incidents.
- One event, one log. No log spam.
Minimum Requirements (Industry Standard Baseline)
Structure
Every log entry must include (where applicable):
timestamplevelserviceenvtrace_id/correlation_idrequest_id(for HTTP)error.kind,error.message,error.stack(for errors)
Levels
DEBUG: local development or targeted sampling onlyINFO: business-relevant milestones (state transitions)WARN: unexpected but recoverable conditionsERROR: failed operations that require attentionFATAL: process cannot continue (rare)
What to Log (and what to never log)
- Log decisions and outcomes, not full payloads.
- Never log:
- passwords, tokens, API keys
- full credit card numbers
- raw personal data unless explicitly approved and masked
Correlation
- Propagate correlation IDs across services.
- Include IDs in every log line for request-scoped work.
Cost Control
- Use sampling for high-volume logs.
- Avoid per-item logs in loops.
References
- OpenTelemetry logging & correlation: https://opentelemetry.io/docs/
- Google Cloud Logging best practices: https://cloud.google.com/logging/docs/audit/configure-data-access
- OWASP Logging Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html