Retaining and minimizing identity records
Every request leaves records behind, and each kind is worth keeping for a different length of time. This lesson follows two short visits by Lantern Studio's administrator to its business account at the photo service: giving each record class its own clock, making a long-kept record small, deleting on schedule without losing track, and proving the policy through what reads and cleanup actually do.
Different records serve different clocks
Lantern Studio, the design agency, keeps its client shoots in a business account at the photo service. At noon on Sunday 11 October, Lantern's administrator gives designer-42, a new hire, the editor role on the client albums. On Monday at 11:30 the administrator signs in again, sees that the change worked, and closes the laptop. Those two short visits leave several kinds of record behind, and they are not kept for the same reasons.
The administrator's session exists so the photo service can recognize the next request without asking for another sign-in. After fifteen minutes without activity it has no purpose left. Every request also produces a diagnostic, a record of how that request ran, which helps the support team investigate a failure while it is fresh. Lantern keeps those for a day. The role change produced an audit record, which has to explain, long afterwards, who gave designer-42 that role and when. Lantern keeps audit records for a year, because its clients' contracts and its own yearly security review both ask questions about the past twelve months.
That is retention set by record class: each kind of record is kept for as long as its purpose needs, and no longer. An email verification code needs minutes. A diagnostic needs a short window for investigation. An accountability record needs as long as someone may reasonably have to answer for the change, which for audits and contracts is commonly a year or more, and longer where a law sets a period. Keeping everything because storage is cheap fails quietly: every extra month is another month in which the records can leak, be read by someone who should not see them, or be copied into a new system.
A purpose can also extend a clock, briefly and on the record. In October of last year someone tried to sign in to a Lantern account from an unfamiliar location, and the studio opened an investigation that is still running. The audit records from that week would normally expire this October, so the studio placed a hold on them until 20 October, when the investigation is due to close. A hold has a stated reason, a defined set of records and an end date that someone reviews. Without those, it turns into permanent retention that nobody notices.
| Record | What it is | Expires (UTC) | At 12:00 |
|---|---|---|---|
| S1 | The administrator's session from 11:30, 15 minutes idle | 12 October 11:45 | Expired |
| D1 | The diagnostic for Sunday's role change request, 24 hours | 12 October 12:00 | Expired |
| A1 | The audit record of Sunday's role change, one year | 11 October next year, 12:00 | Kept |
| J1 | An audit record from last October whose normal expiry has passed | Held until 20 October 12:00 | Kept for the investigation |
All organizations, people, hosts and identifiers in these examples are fictional.
Lantern decides these periods for its own records. The photo service also keeps records of its own about Lantern's accounts, such as the security log of each sign-in it checked, under its own policy and its own obligations. Lantern's settings do not reach those, in the same way that Lantern cannot set the retention of its bank's records about its payments.
Minimize the record before retaining it
A record that is kept for a year should be small enough to deserve it. Here is A1:
{
"event_id": "evt-8c41e07a",
"time": "2026-10-11T12:00:04Z",
"account": "lantern-studio",
"actor": { "type": "user", "id": "lantern-admin-7" },
"subject": { "type": "user", "id": "designer-42" },
"action": "member.role.assign",
"resource": { "role": "editor", "albums": "client-shoots" },
"outcome": "succeeded",
"request_id": "req-5e09b2d4"
}It answers who did what, to whom, when, and with what result, and its request ID leads to the matching diagnostic. It does not contain the administrator's password, a session cookieA small value that a website asks the browser to store and send back with later matching requests. Cookies commonly carry a session identifier, so the site can recognize an ongoing sign-in without your password., an access tokenA token that a client presents to an API to use access it has been granted, usually limited in what it allows and how long it lasts. It authorizes API calls; it does not tell the client who signed in., the raw request body or a copy of the designer's profile. None of those would help explain the change, and each would turn the audit store into a second copy of the account, needing the same protection as the account itself.
The actor and the subject are separate fields, and both hold stable identifiers rather than names. The administrator gave the role, and designer-42 received it. If either of them changes their display name next year, the record still points at the right account. Evidence and governance metrics shows how records like this answer an auditor's questions.
D1 looks different. It holds the HTTPThe Hypertext Transfer Protocol, the rules browsers, apps, and servers use to send requests and responses on the web. method, the status codeThe three-digit number at the start of an HTTP response that says how the request went, such as 200 for success, 302 for a redirect, or 401 when authentication is needed., the processing stage the request reached, how long it took, and the same request ID. It explains how a request ran rather than who is accountable for a change, which is why it is a separate record with its own clock rather than a duplicate of A1.
Reading either kind of history is a sensitive act in its own right, because history shows who works with whom, when and from where. Lantern gives read access to its audit records only to the people who need to answer for changes, and support engineers who read diagnostics do not automatically get the audit as well. Each read of the audit is itself recorded, so the people who watch the history are watched too.
Storage limitation is one of the EU GDPR's principles for processing within its scope: personal data should be kept in a form that identifies people for no longer than its purpose needs. The principle does not supply a number. Lantern's periods come from its purposes and its obligations, not from an imagined rule that every identity record expires after the same number of days.
Deletion has a lifecycle too
Records leave in more than one way. Most simply expire when their period ends. Some are removed early because the person they describe has a right to erasure, as Consent, rights, and deletion described. And sometimes someone asks for history to be removed for no good reason at all.
At 12:00 on Monday, a studio manager asks for Lantern's audit to be wiped "to tidy up". An audit that the people it describes can quietly empty is not evidence of anything, so the photo service treats erasing history as an authority of its own, separate from reading it, and Lantern has given it to nobody. The request is refused, and S1, D1, A1 and J1 are untouched by it. Where history can be cleared at all, the clearing leaves a small record behind, saying who cleared what and when, so that the gap itself is explained.
History also has copies. An audit export on someone's laptop, a report built from last month's diagnostics, a cache in front of the history store and nightly backups can each outlive the original. Each copy needs its own protection and its own expiry, and restoring a backup must not bring back records that should already have gone.
Cleanup itself can fail. At 12:05 the scheduled cleanup removes S1, then stops on D1 when the store times out. Because it writes down what it did as it goes, the failure leaves a clear record:
| Receipt | Done | Still to do | Kept |
|---|---|---|---|
| Revision 1, interrupted | S1 | D1 | A1, J1 |
| Revision 2, after recovery | S1, D1 | Nothing | A1, J1 |
The receipt is what makes recovery exact. A cleanup that restarted from the beginning would repeat destructive work it had already done. One that skipped ahead to the next kind of record would leave D1 behind with nobody aware of it. With the receipt, recovery removes D1 alone, under the same scope it recorded, and writes revision 2.
Prove the policy in reads and cleanup
A retention policy is proven by what authorized reads return. After the cleanup, S1 and D1 no longer appear in any list, detail view or export. A1 and J1 still do, until their own dates. Looking up an event ID from another organization's account returns "not found", never that organization's record.
On Tuesday morning, a history read returns nothing. It matters a great deal which kind of nothing it is:
HTTP/1.1 200 OK
Content-Type: application/json
{ "events": [], "next": null }
HTTP/1.1 503 Service Unavailable
Content-Type: application/json
{ "error": "history_unavailable" }The first response is a statement: the store was read, and nothing matched. The second says the store could not be read, so the records are unknown and the cleanup receipt is unchanged. If a dashboard turned that 503 into an empty list, it would look exactly like a successful deletion. The right recovery is to restore the store, check the reader's permissions again and read once more, confirming that A1 and J1 are still there. Retrying a destructive cleanup because a read failed is never part of the recovery.
200 OK
- Body
- "events": []
- The store
- Was read
- The records
- Nothing matched
- Cleanup receipt
- Unchanged
A statement about the store
503 Service Unavailable
- Body
- "error": "history_unavailable"
- The store
- Could not be read
- The records
- Unknown
- Cleanup receipt
- Unchanged
Restore the store and read again
If a dashboard turned that 503 into an empty list, it would look exactly like a successful deletion.
Finally, the periods themselves belong with the people accountable for the records, and changing one is a change like any other: recorded, with the old and new values, and checked against what it would remove. If Lantern shortened its audit retention to six months tomorrow, J1 would still stay until its hold ends on 20 October, because a hold exists precisely to outlast the normal clock. A retention policy written in a document means something only when storage, readers and cleanup all behave the way it says.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Verify a retained history without retaining credentialsRead Ava's Audit and Logs, show both are refused to someone without history permissions, then work through expiry, an interrupted cleanup and an unavailable store.