KatInterview

Build a Company-Wide Log Aggregation and Search Platform

System DesignModel answer
MediumModel answerSystem Designsystem-designloggingobservability

Last updated

Design a scalable platform that collects logs from many services, stores them durably with retention, supports filtered search, survives traffic spikes, and isolates tenants.

Your organization runs a large fleet of microservices and scheduled batch jobs spread across many hosts and containers. Each of them produces log output, and engineers need one place to collect, keep, and search it.

Design a centralized log aggregation and search platform that meets these needs:

  • Collection: accept log events from a very large number of producers.
  • Durability and retention: keep acknowledged logs safely, and expire them according to a retention policy.
  • Search: let users narrow results by time window, service, host, severity level, and request or trace ID.
  • Resilience: cope with sudden traffic spikes and with partial failures of internal components.
  • Isolation: provide basic authorization and keep tenants (for example teams or environments) separated from one another.

In your answer, cover:

  1. Assumptions and a rough capacity estimate
  2. The main components and how data flows from producer to query result
  3. The event data model and your indexing approach
  4. How the system scales
  5. Reliability, failure handling, and security considerations

A diagram is not required, but the path a log line takes through the system should be unambiguous.

Hints

Hint 1

Start by scoping: write rates, average event size, hot versus archived retention, freshness target, and expected query latency. This is a write-heavy system with comparatively rare reads, which should shape your choices.

Hint 2

Put a durable buffer (such as a partitioned commit log) between the ingestion tier and the indexing tier, so spikes and downstream outages become consumer lag instead of lost data.

Hint 3

Avoid indexing every token. Prune by tenant and time first, index only low-cardinality labels, give trace IDs a dedicated lookup structure such as bloom filters, and scan for free text.

Hint 4

Decide where tenant identity comes from (the authenticated producer, not the payload) and how quotas stop one noisy tenant from harming others.