← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 040 · Security and data protection

Design an Audit Log Pipeline

Medium 50 min

A business software company must record every administrative action across its products: who changed a permission, exported customer data, deleted a record or changed a billing plan. Regulators and enterprise customers require the log to be complete, tamper-evident and searchable for 7 years, and customers want to search their own tenant's events in the admin console. Forty services emit audit events, about 3,000 per second at peak. Losing an event, or letting an insider quietly edit one, would be a serious compliance failure.

Functional requirements

  • Services emit structured audit events: actor, action, target, tenant, time and source IP
  • Customers search their own tenant's events by actor, action and date range
  • Auditors export events for any time range in the last 7 years
  • Detect and report any modification or deletion of stored events

Non-functional requirements

  • No acknowledged event is ever lost
  • Recent events are searchable within 1 minute
  • Stored events cannot be altered or deleted, even by administrators, before retention ends
  • Each tenant can only see its own events

Constraints and scale

  • 3,000 events per second at peak, about 1 KB each
  • Roughly 100 million events a day, about 35 TB a year before compression
  • 7-year retention; the last 90 days must be searchable interactively

You will practise

  • Build an append-only, write-once storage path for compliance data
  • Make tampering detectable with hash chaining or signed digests
  • Separate a hot search tier from cheap long-term archival storage
Show 3 hints
  1. If a service crashes right after a change but before sending the audit event, is the event lost? How could the two be written together?
  2. How could an auditor prove that event 4,812,337 has not been changed since it was written?
  3. Does a 6-year-old event need to live in the same expensive index as yesterday's?

Ready to build?

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

Sign in to start

Failure scenarios

  • An insider tries to cover their tracksA database administrator with broad access exports a customer's data and then tries to delete the matching audit events from the search index and the archive.

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