Preparing your design workspace

Loading the problem and your latest saved attempt…

Design an Auditable Event Trail Service

Retain attributable action events and let authorized auditors query an honest, immutable history.

Problem statement

For this exercise, assume authenticated application services append tenant-scoped audit events describing actions. Each event contains a stable event ID, producer identity and sequence, actor and resource references, action, outcome and occurrence time.

Authorized auditors query a bounded time range, optionally filtered by resource.

An accepted event is immutable and must survive one availability-zone loss. Identical retries recover the same durable receipt; conflicting payloads under the same tenant/event identity are rejected. A correction is a new event linked to the earlier event, not an edit to history.

Producer sequence can reveal gaps and order within that producer, but timestamps may arrive late and no global real-time order is promised. The query index may lag. Results must expose their ingestion watermark and use snapshot-bound pagination rather than imply that an absent indexed event never occurred.

Retain accepted events for 90 days from acceptance. Queries must not return expired payloads, and an expired pagination snapshot produces an explicit restart response. Protect tenant boundaries and restrict actor/resource details; never accept arbitrary secret payloads.

Design append admission, durable history, query projection, correction links, retention and recovery. The audit service does not make an upstream business transaction and its HTTP append atomic; producers needing that guarantee must supply their own durable handoff.

Operational log dashboards, unrestricted text search, a global sequencer and legal compliance certification are outside scope. These are bounded practice facts completing the report's compiled Audit Log topic, not a claim that its author reported these exact requirements.

This practice exercise is based on an interview-preparation compilation, not an independently dated interview occurrence.

What to build

  1. Authorized services append attributable action events and recover one durable receipt for an identical retry.
  2. Authorized auditors query a tenant's retained events by time and resource with explicit indexing progress and stable pagination.
  3. Corrections preserve the original event and link a new event; retention expires old payloads without exposing another tenant's history.

At scale

  • For this exercise, assume a peak of 10,000 events per second, each at most 2 KB, with90 days of retention from acceptance.
  • For this exercise, target append p95 below 200 ms and indexed queries over a recent one-hour interval below 1 second p95; require bounded query pages.
  • For this exercise, normal indexing lag is below 30 seconds and must be reported when exceeded. Every acknowledged event survives one-zone loss; a lagging index is not the history authority.