Structured Logging
Noun · Development
Definitions
Logging in a machine-parseable format (JSON, logfmt) with consistent key-value fields instead of free-text strings. Enables filtering, aggregation, and correlation in log management tools (ELK, Loki, Datadog). Include request_id, user_id, duration_ms, and error details as structured fields. Unstructured logs are nearly useless at scale.
In plain English: Logging in a structured format (like JSON) with labeled fields instead of messy text, making logs easy to search and analyze.
Example: "{"level":"error","msg":"payment failed","user_id":"u_123","amount":99.99,"error":"card declined","request_id":"req_abc"} -- searchable, filterable, alertable."