Hard · 10 steps · ~75 min
Design log aggregation and search
Ingest a firehose of logs, search them in seconds, and keep them cheaply.
Thousands of services write log lines. Engineers search them during incidents, and auditors need months of history. Ingest must never lose data or slow the apps, search must be fast, and storing everything must not bankrupt you.
Same problem as Elasticsearch / ELKSplunkDatadog Logs
How it works
- Ingest: a constant firehose of small writes with sudden spikes (write-heavy).
- Search: bursts of text queries over a time range (read, latency-sensitive).
- Retain: old data is rarely read but must be kept for months.
What you'll build
- The API and the data model
- A stream that buffers bursts, with indexing workers
- A search index and a query cache
- A cold archive tier to cut retention cost
- Designs that survive a lost indexer and a cold cache
Steps
- 1Design the API
- 2Design the data model
- 3Search a small deployment
- 4Absorb a burst without losing logs
- 5When indexers fall behind
- 6Keep 90 days without paying for it
- 7What makes search fast
- 8Lose an indexer
- 9Survive a cold query cache
- 10Deep dive: retention and cost