← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 025 · Observability and operations

Design a Log Collector

Easy 35 min

Your company runs 500 servers, each writing about 200 log lines per second. Today engineers SSH into machines and grep files, which is slow and impossible once a server is replaced. Design a log collector: an agent on every server ships logs to a central system where engineers can search the last 30 days by time, service, host and free text. Logs should be searchable within 30 seconds of being written, and a slow search cluster must never cause servers to drop logs.

Functional requirements

  • An agent on every server tails log files and ships them centrally
  • Search logs by time range, service, host, level and free text
  • Keep logs searchable for 30 days, then archive them cheaply for a year
  • Show the newest matching lines for a service in near real time

Non-functional requirements

  • Logs are searchable within 30 seconds of being written
  • No logs are lost when the indexing cluster is slow or restarting
  • Typical searches over one day return in under 3 seconds

Constraints and scale

  • 500 servers producing 100,000 log lines per second in total
  • Average line size of 300 bytes, so about 2.5 TB per day before compression
  • Agents send batches about twice a second: roughly 1,000 ingest requests per second

You will practise

  • Decouple producers from slow consumers with a durable stream
  • Batch and compress at the edge to make ingestion cheap
  • Tier storage between a hot search index and cheap archives
Show 2 hints
  1. What should happen to new log lines while the search index is being upgraded?
  2. Searchable for 30 days and archived for a year are very different storage needs.

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • The search cluster slows to a crawlA heavy query and a node restart halve indexing throughput for 40 minutes while a production incident doubles log volume.

Run them from the workspace once your design is in place.