Distributed Logging
On one machine, "check the logs" means one file. Across dozens of services, it needs a whole pipeline.
Intermediate
| Practice | What it enables |
|---|---|
| Structured logging | Log entries as machine-parseable key-value data (JSON) instead of free text, so a logging system can filter, aggregate, and query them precisely. |
| Correlation / trace IDs | A single ID generated when a request first enters the system, passed along to every downstream service call it triggers, and included in every log line along the way — turning a scattered mess of log lines back into one coherent story for that request. |
{"ts":"2026-08-09T14:02:11Z","service":"payment","level":"error",
"trace_id":"7f3a9e21","order_id":482,"msg":"card declined"}
trace_id=7f3a9e21 across every service's logs and see the entire request's path in order, instead of manually cross-referencing timestamps across four separate log files.| Component | Role |
|---|---|
| Log agent | Runs alongside each service, tailing its log output and forwarding entries centrally — so logs survive even if the machine that generated them is later terminated. |
| Ingestion pipeline | Receives logs from every agent, often buffered through a message queue to absorb bursts without dropping entries. |
| Log storage | A search-optimized store (see Distributed Search) — logs are fundamentally full-text, filterable data, which is exactly what search indexes are built for. |
| Query / dashboard layer | Lets engineers search, filter, and build alerts on log content. |