Quick revision
The short answer
I would set one audit event standard (actor, on-behalf-of, action, resource, time, correlation id) that every service, job and consumer emits, capture identity once at the edge and carry it through calls and events in a way downstream services can trust, and write audit events to a separate, tamper-evident, access-controlled store with a seven-year retention rule. Audit trails are kept apart from application logs, which have different retention and access. And the architecture is only accepted when regular control checks trace sample changes end to end.
What to remember
In this answer, we saw that the auditors' requirement has three parts: completeness, attribution and durability. We answered them with one versioned audit event format, identity captured at the edge and carried in a trusted way through calls and events, events written through an outbox to an append-only, tamper-evident store with seven-year retention, a change data capture safety net, and a clear separation from application logs. Finally, regular control checks trace sample changes end to end, so we can prove, every quarter, that the architecture still works.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would set one audit event standard (actor, on-behalf-of, action, resource, time, correlation id) that every service, job and consumer emits, capture identity once at the edge and carry it through calls and events in a way downstream services can trust, and write audit events to a separate, tamper-evident, access-controlled store with a seven-year retention rule. Audit trails are kept apart from application logs, which have different retention and access. And the architecture is only accepted when regular control checks trace sample changes end to end.
Why this question is asked
An auditor's requirement like this sounds like a logging task, but it is really an architecture decision that will outlive most of the services it covers. Seven years is longer than the lifetime of many systems, frameworks and even teams, so whatever we choose must survive rewrites, migrations and reorganisations. Interviewers ask it at this level to see whether we can turn a compliance sentence into concrete, testable building blocks, and whether we know the costs of each choice. In this answer, we will break down what the requirement really asks, define the audit event, design how identity is captured and carried, choose the store, separate audit from logs, and then see how we prove the whole thing works year after year.
1What the Requirement Really Asks
'Every change to customer data can be traced to the person or system that caused it' has three parts. Every change means completeness: changes from APIs, batch jobs, message consumers, admin tools and even manual database fixes. Traced to the person or system means attribution: a real actor, not 'system', and when a service acted for a person, both. Kept for seven years means durability and integrity: the records must still exist, still be readable and still be trustworthy long after the code that wrote them is gone.
A senior answer starts by naming these three properties, because each one maps to a different part of the architecture, and because each one has a cost that the business must accept explicitly.
2One Audit Event Format for Everyone
The foundation is a single, versioned audit event format, owned by the platform team and used by every service. It answers who, on whose behalf, did what, to which resource, when, and as part of which larger action.
Notice that the change section names the fields that changed rather than copying full before and after values. Personal data stored for seven years is a liability under privacy law, so we keep the audit record as small as the auditor needs and keep values only where they are required, ideally encrypted with a key that can be destroyed when a customer must be forgotten.
3Capturing and Carrying Identity
Identity is captured once, at the edge, where it is strongest: the gateway and each service validate the caller's token and know who the user or client is. From there, synchronous calls carry it by forwarding the token or exchanging it for a downstream token, and asynchronous work carries an explicit actor block in event headers. Batch jobs run as named job identities and record who triggered or configured them.
Carrying it 'in a trusted way' matters as much as carrying it. A header like X-User-Id that any service can set is an invitation to forge attribution. So services accept identity only from authenticated callers, Kafka ACLs control who may write identity-bearing topics, and the most sensitive flows sign the actor block.
For completeness, we add a safety net below the application: change data capture on the customer databases records every row change, including manual fixes. Rows changed without a matching application audit event are flagged and investigated, which catches both missing instrumentation and people working around the system.
- EdgeGateway and services validate tokens; identity captured once
- PropagationToken forwarding or exchange for calls; actor headers on events
- EmissionShared audit library writes events in the same transaction (outbox)
- Safety netChange data capture flags changes without an audit event
- Audit storeAppend-only, hash-chained, write-once storage, 7-year retention
- AccessSeparate roles for investigators; every read is itself audited
6 layers, from the top down. Step through them one at a time.
4Choosing the Audit Store
Audit events must not be lost when a service crashes after committing a change, so the shared library writes them through an outbox: the audit event is inserted in the same database transaction as the business change, and a relay publishes it afterwards. Either both happen or neither does.
The store itself must be append-only and tamper-evident. Tamper-evident means that a deletion or modification can be detected even by someone with administrator rights. We achieve this with hash chaining (each batch records the hash of the previous one, so removing a record breaks the chain) and with write-once object storage, such as an object lock in compliance mode, where even the account owner cannot delete objects before their retention date. Access is limited to a small investigator role, and every read is audited too.
It helps to put numbers on it. If the company makes about 20 million customer data changes a day and an audit event is about 1 KB, that is roughly 20 GB a day, 7 TB a year and about 50 TB over seven years before compression. That is affordable in object storage with a lifecycle that moves older years to cheaper tiers, and it tells us not to keep it all in a hot database.
5Audit Trails Are Not Application Logs
It is tempting to say 'we already log everything'. But logs and audit trails serve different readers and have different rules, and mixing them weakens both.
| Property | Audit trail | Application log |
|---|---|---|
| Purpose | Prove who changed what | Debug and operate the system |
| Retention | Seven years, legal hold possible | Weeks to months |
| Integrity | Append-only, tamper-evident | Best effort, may be sampled or dropped |
| Access | Small investigator role, reads audited | Most engineers |
| Content | Structured, versioned schema | Free text, changes with every release |
6Proving It Works, Every Quarter
An audit architecture that nobody tests decays quietly: a new service skips the library, a consumer drops the headers, a migration loses a year of records. So the last part of the design is a recurring control check, run with the risk or compliance team. Each quarter we pick a sample of real changes, for example 25 changes from different channels, and trace each one from the customer record back to the actor, through every service and event, using only the audit store.
We also automate what we can: contract tests in every service that a change produces a valid audit event, a dashboard of changes without an audit event from the change data capture net, and an alert when the share of unknown actors rises. The quarterly sample then becomes a confirmation rather than a discovery exercise, and its report is exactly the evidence auditors ask for.
7Follow-up questions
How do we handle a customer's right to erasure when audit records must be kept for seven years?
Legal retention obligations usually take precedence for the audit record itself, but we minimise what it holds. Records reference customers by internal ids and store changed field names rather than values; where values are needed, they are encrypted with a per-customer key. When erasure applies, we destroy the key, which makes the values unreadable while the fact that a change happened, and who made it, remains. Legal and privacy teams should confirm the rule for each jurisdiction.
What do you do about services that cannot be changed soon, such as a vendor product?
We wrap them. The change data capture net records their database changes, and the integration layer in front of them records the caller's identity, so we can correlate the two. We record the gap formally as a known exception with a date, because auditors accept a documented, compensated gap far more readily than a hidden one.
How would you get 100 teams to adopt this?
Make the right thing the easy thing: the shared library emits valid audit events with one annotation or call, the starter wires the outbox and the propagation, and the platform team pairs with the first few teams. Then we measure coverage per service from the change data capture net and review it in the same forum that reviews security findings.
8Conclusion
In this answer, we saw that the auditors' requirement has three parts: completeness, attribution and durability. We answered them with one versioned audit event format, identity captured at the edge and carried in a trusted way through calls and events, events written through an outbox to an append-only, tamper-evident store with seven-year retention, a change data capture safety net, and a clear separation from application logs. Finally, regular control checks trace sample changes end to end, so we can prove, every quarter, that the architecture still works.
Open with
I'd read the requirement as three properties: completeness, every change from every channel; attribution, a real actor and anyone acting on their behalf; and durability, records that stay complete and trustworthy for seven years.
Then, if they want more
First, I'd set one versioned audit event format owned by the platform: actor, on-behalf-of, the service that performed it, action, resource, time and correlation id, with changed field names rather than full personal data.
Second, identity is captured once at the edge where tokens are validated, carried through synchronous calls by forwarding or token exchange, and through events as signed or ACL-protected actor headers, and batch jobs run as named job identities.
Third, services emit audit events through a shared library using an outbox, so the event and the change commit together, and change data capture on the databases flags any change that has no audit event, including manual fixes.
Fourth, the audit store is separate from application logs: append-only, hash-chained, on write-once storage with seven-year retention, readable only by an investigator role whose reads are audited. Logs keep their short retention and broad access.
As a sizing check, twenty million changes a day at a kilobyte each is about fifty terabytes over seven years, so this belongs in tiered object storage.
Finally, I'd make it testable: contract tests per service, coverage dashboards, and a quarterly control check where we trace a sample of real changes end to end and give the report to the auditors.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Security reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Auditors require that every change to customer data can be traced to the person or...": https://scrivio-interview-library.netlify.app/spring-boot/security-architecture/52b870c5c2/