Lesson 1 of 9 · 20m
Centralized Logging: The Pipeline Mental Model
Why logging is a distributed systems problem, where data loss really happens, and the five pipeline stages every design must account for.
Most teams treat centralized logging as a product purchase. It is not. It is a distributed data pipeline that starts inside every process you run and ends on disks you pay for every month. When it breaks, it usually breaks during the incident you needed it for.
The five stages
app -> collection -> transport -> processing -> storage/search
| | | | |
stderr filebeat kafka/nats logstash elastic
stdout vector direct tcp ingest node lokiEach boundary can drop, duplicate, delay, or deform logs. If you cannot say which guarantees each stage provides, you do not have a logging architecture — you have hope.
Log loss is usually boring
The classic failure is not a shard explosion or a corrupt index. It is an application writing to stdout inside a container, the node rotating containerd files after 10 MB, and the collector reading the file too slowly during a deploy storm. The logs existed for ninety seconds and then were gone.
Another common one: a sidecar collector restarts and rereads a file from the beginning. Congratulations, your storage bill doubled and every alert based on rate-of-errors fires.
Design for backpressure, not average traffic
Average ingest traffic is meaningless. The shape that matters is the worst five minutes: deploys, retry storms, cascading failures, and the inevitable service that logs every request body at INFO.
A healthy pipeline has explicit behavior when downstream is slow:
if queue_full:
drop_low_value_logs or block_producer or spill_to_diskPick one per layer. "The queue grows forever" is not a strategy; it is an outage with a delay.
Field notes
- Put a timestamp on the event as close to creation as possible. Ingestion time is useful, but it is not event time.
- A dropped log with a metric is observability. A silently dropped log is a future mystery.
- Duplicate delivery is normal. Design queries and alerts to tolerate duplicates instead of pretending at-most-once exists.
- Keep pipeline configuration boring. Every clever transformation is production code with worse testing.
Was this lesson helpful?