Why structured (JSON) logging, and what fields should every log line have?
BeginnerProductionLog Pipelines
Answer
Structured logs can be filtered and aggregated without fragile regex. Standard fields:
{"ts":"2026-11-09T10:15:02.113Z","level":"error","service":"checkout","env":"prod",
"trace_id":"4bf92f3577b34da6a3ce929d0e0e4736","span_id":"00f067aa0ba902b7",
"msg":"payment authorization failed","order_id":"o-82913","error":"card_declined","duration_ms":412}
trace_id is the key one: it links logs to traces. Agree on field names org-wide (OpenTelemetry semantic conventions are a good base).
More on Log Pipelines
What does a production log pipeline look like end to end?BeginnerFluent Bit, Vector, Grafana Alloy or the OpenTelemetry Collector: how do you choose a log agent?IntermediateWhy add an aggregation tier instead of sending directly from agents to the backend?IntermediateHow do you design log retention tiers?IntermediateHow do you scrub PII from logs in the pipeline?IntermediateHow and when do you sample logs?Intermediate