Design a distributed log collection system
hard 45 minCollect a million log lines a second from 100,000 servers, keep every acknowledged line, make recent lines searchable within 30 seconds and keep a year of them at a bearable cost.
Where it shows up
The same pattern appears across everyday software.
Finding one failed payment
An engineer searches a trace id across every service and reads the request in time order.
Watching a release
Live tail shows new warnings while the first servers run the new version, so the release can stop early.
Elasticsearch data streams
Elasticsearch offers rollover and lifecycle rules so that indices move from hot to cheaper nodes and are then deleted.
Label-only indexing
Grafana Loki indexes labels, not the words of a line. Its documentation warns that labels with very many values make it perform badly.
Agents on every node
Fluent Bit keeps file offsets in a small database and promises at-least-once delivery after a crash.
Audit trails
Who looked at which record is kept in a separate store with its own retention and stricter access.