The interview problem

Practice prompt

Design an audit service for a multi-tenant administration platform. Record permission changes, exports and configuration updates. Investigators must detect modification or removal of accepted records and retrieve a verifiable export. Handle 100 million events/day and a compromised application administrator without claiming the log proves every real-world action occurred exactly as reported.

Original system-design practice, not a reported interview. Workloads and trust assumptions are hypothetical. Primary technical references retrieved September 27, 2026.

1. Define the attacker and the evidence boundary

Assume application administrators can modify application data but cannot administer the audit store, signing service or independent checkpoint destination. Audit operators can investigate records but cannot silently rewrite accepted history. If one attacker controls all producers, storage, signing keys and checkpoints, this design cannot manufacture an independent witness.

Tamper evidence means a verifier can detect changes relative to a trusted commitment. It does not establish that a producer told the truth or emitted every event. Separate event authenticity, post-acceptance integrity and capture completeness in the requirements.

Define which operations must leave durable evidence before returning success. For critical permission mutations, use an audit outbox in the same transaction as the business mutation. An attempted but rejected operation needs its own event path because it has no successful business transaction to attach to.

2. Capture events with explicit identities

An event contains tenant, producer identity, producer event ID, actor, action, resource identifier, result, request correlation ID, event time and schema version. Prefer a bounded change summary over dumping secrets or full customer documents. Authenticate the producer separately from its claimed actor field.

The producer retries an outbox record until the audit service acknowledges durable acceptance. Deduplicate on producer and event ID, comparing a payload hash so a conflicting retry cannot replace the first event. Persist the accepted event and deduplication result in a replicated append journal before acknowledging; segment builders consume this journal asynchronously. Return an authenticated acceptance receipt containing payload hash, audit partition and sequence. The business commit and remote audit acceptance are distinct milestones.

A compromised application database administrator might remove an unshipped outbox entry. Independent database-change monitoring or operation reconciliation can help expose this, but the outbox alone does not defeat that attacker. State whether a critical action must wait for a separate pre-action authorization record, and account for the availability cost and the difference between intent and completed outcome.

3. Commit immutable segments

Route events to append partitions, for example by tenant and a stable subpartition. Each has one fenced sequencing authority per epoch. Assign acceptance order independently from event timestamps; clocks can skew, and late producers can report old actions. There is no global chronological ordering promise across partitions.

Write bounded immutable segments. A manifest identifies the partition, epoch, first and last sequence, event count, exact object version, byte length, content hash and previous manifest hash. Specify a versioned canonical byte encoding with unambiguous field lengths. Hashing a loosely reserialized JSON object is not a reproducible verification contract.

Sign each manifest using a separately controlled signing service and publish its digest to an independent checkpoint destination. Keep signing permissions narrower than storage administration. Segment objects use retention controls appropriate to the agreed operating policy; encryption protects confidentiality but does not itself prove integrity.

At failover, a new writer obtains a higher fencing epoch. Storage rejects the old writer's commits. Recover accepted journal entries after the last checkpoint and seal them before linking the new epoch. Do not roll back to the checkpoint and discard acknowledged entries; document any unavailable range instead of silently resetting sequence numbers.

4. Explain what a hash chain detects

If an attacker alters a segment, its content hash no longer matches the signed manifest. Removing an interior segment creates a missing referenced object or sequence gap. Changing a manifest breaks its signature or its link from a later trusted manifest.

Deleting the entire tail is harder: a locally self-consistent old prefix can look valid. A verifier needs an independently retained recent checkpoint and expected partition coverage to detect rollback. An empty interval should have a signed heartbeat checkpoint so silence is distinguishable from missing publication.

A checkpoint every five minutes gives an exposure window before the next checkpoint is witnessed. It does not guarantee detection within five minutes if verification runs only daily or the checkpoint destination is unavailable. Monitor publication age and verification age separately.

Signatures prove possession of the signing key, not the factual correctness of the event. Preserve public-key versions and rotation records for old verification. After key compromise, identify the affected trust interval and use external checkpoints; blindly re-signing old data does not restore lost trust.

5. Calculate storage and segment overhead

At 100 million events/day and 1 KB/event in decimal units, raw payload is 100 GB/day. Ninety days require 9 TB; three full copies require 27 TB before indexes and backups. Average acceptance is about 1,157 events/second, with a hypothetical twentyfold peak near 23,150/second.

Segments of 10,000 events average about 10 MB payload under the assumed event size; enforce a separate byte limit because individual events vary. Event-count packing alone would require at least 10,000 segments/day. Time-based flushing, tenant isolation and uneven partition load increase that number.

For example, 100 continuously active partitions each flushing every five minutes produce 28,800 segments/day before extra size-triggered flushes. At 2 KB per manifest, their manifest payload is about 57.6 MB/day. This is small relative to event payload, but signing throughput, object-request overhead and verification scheduling still matter.

Bound event size, tenant ingestion rate and query cost. Do not let one enormous export starve acceptance of new audit records. Monitor outbox age, acceptance latency, uncheckpointed events and rejected conflicting duplicates.

6. Separate search convenience from authoritative evidence

A derived index supports searches by actor, resource and time. Investigators retrieve the authoritative segment and manifest for selected hits. A healthy index is not proof that all matching records were indexed, so report index watermark and gaps alongside search results.

An export includes the query definition, tenant scope, acceptance-sequence boundaries, source manifests, checkpoint references and verifier instructions. For full-range completeness, enumerate all expected segments for the requested partitions and boundaries; a few valid inclusion proofs cannot prove that a query omitted nothing.

Enforce investigator authorization and log access to the audit service itself through a separate controlled path. Redaction views should not silently replace committed bytes. Where the data policy requires removal, represent retention or deletion actions explicitly and define what verifiable metadata remains; do not promise both indefinite content retention and arbitrary content erasure.

7. Fail visibly and rehearse verification

If ingestion is unavailable, critical business changes may stop once a bounded durable buffer is exhausted. Lower-risk operations can follow a separately agreed degraded policy, but must not report complete audit coverage. A successful application response and an empty audit queue are not equivalent evidence.

Test modified bytes, missing middle and tail segments, old checkpoints, wrong keys, duplicate conflicts, stale writers and an incomplete search index. Restore from backup and verify against externally retained checkpoints before serving evidence. Periodically run the independent verifier on known test fixtures as well as production ranges.

Follow-ups: What if the producer lies about the actor? How do you prove no partition was omitted? Can a timestamp establish order? What changes when signing keys and storage share an administrator?

Score 0–2 each for trust boundaries, capture completeness, tamper verification, bounded capacity and honest query/export guarantees.

Durable acceptance
Signed segment
Independent checkpoint
Verifier
The independent witness exposes rollback; it does not prove that a producer reported every action.

Verify a missing-tail incident

Additional original practice exercise · October 3, 2026. Numbers are illustrative assumptions.

An independent witness retains a signed checkpoint through sequence 10,000 for partition P. A restored audit store presents a valid chain only through 9,000. Every available signature may verify, yet the export is incomplete relative to the witness. Report the missing range 9,001–10,000 instead of calling the old prefix valid complete history.

Now suppose an export contains records through 10,000, but its search index stops at 9,500. Querying the index alone can omit matching records among the final 500. Validate coverage against authoritative sequence boundaries or disclose an incomplete search result; byte integrity and query completeness are different properties.

Practice: ask whether the same proof detects an action never emitted by a compromised producer. It does not. That needs an independent observation or reconciliation mechanism. Keep verifier outcomes explicit: valid for a stated boundary, invalid, or unverifiable because required evidence is missing.

Related practice: Reclaim unreferenced blobs safely · Design a lease service with fencing tokens

Sources and next steps

The partitioning, trust model, protocol and calculations above are original design choices, not a CloudTrail implementation description or a claim of regulatory compliance.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.