An LLM Audit Log Schema for Regulated Teams (With Example)

A useful LLM audit log records enough to reconstruct and explain any AI-assisted decision: who asked, which exact model snapshot and prompt version ran, what context was retrieved and at which document version, what tools were called, what the output was, what controls and human reviews applied, and what it cost. Store it append-only with tamper-evident hashing, redact or hash sensitive inputs deliberately, and set retention with legal advice rather than by default.
Regulated teams, and teams whose clients are regulated, get a particular kind of question after an AI-assisted decision: why did the system say that, which version produced it, and who approved it? Normal application logs, with a request line and a status code, cannot answer any of those. This post lays out a schema for an LLM audit log that can.
This is an engineering view, not legal advice. What you must keep, for how long, and in what form depends on your sector and jurisdiction, so involve counsel and your compliance function in the retention and privacy decisions.
The principle: reconstruct, then explain
The test for every field is whether it helps someone reconstruct what happened and explain it later. That means recording identifiers and versions, not just text. "The model" is not enough; you need the exact snapshot. "The prompt" is not enough; you need the template version and a hash of what was actually sent.
The fields that matter
- Identity and time: a unique event ID, a trace ID that ties the event to the rest of the request, a precise timestamp, the tenant or account, and the actor (user or system) with their role.
- Model: provider, model name, and the exact snapshot or version, plus the parameters that affect output such as temperature. Aliases like "latest" are not auditable on their own.
- Prompt: template ID, template version and a hash of the final rendered prompt. This lets you prove what was sent without necessarily storing all of it.
- Input handling: whether the input is stored in full, redacted or only hashed, and which sensitive fields were removed. Decide this deliberately, because the log itself becomes a store of personal data.
- Context: for retrieval systems, the document IDs, document versions and chunks supplied to the model. Without document versions you cannot tell what the model saw if the source later changed.
- Tool calls: the name of each tool, a status, and an idempotency key so repeated actions can be recognised.
- Output: the response or a hash of it, depending on your storage policy.
- Controls: which guardrails or checks ran and their results, and whether human review was required.
- Human review: the reviewer, their decision (approved, edited, rejected) and when. This is often the most important part for accountability.
- Usage: tokens, cost and latency. Useful for operations and for catching abuse.
- Integrity: a hash of the record and the previous record's hash, so tampering is detectable.
An example record
{
"event_id": "evt_01JD8K3",
"trace_id": "9f2c41a0b7",
"timestamp": "2026-11-05T09:14:22.418Z",
"tenant_id": "acct_4821",
"actor": { "type": "user", "id": "usr_193", "role": "analyst" },
"model": {
"provider": "example-provider",
"name": "model-name",
"snapshot": "2026-09-15",
"parameters": { "temperature": 0.2, "max_tokens": 800 }
},
"prompt": { "template_id": "claims_summary", "version": 14, "sha256": "e3b0c4..." },
"input": { "stored": "redacted", "sha256": "5d41e4...", "pii_fields_removed": ["name", "phone"] },
"context": [{ "doc_id": "pol_7731", "doc_version": 3, "chunk": 12 }],
"tool_calls": [{ "name": "lookup_policy", "idempotency_key": "ik_88a2", "status": "ok" }],
"output": { "stored": "full", "sha256": "7c6a18..." },
"controls": { "guardrail": "pass", "pii_scan": "pass", "human_review": "required" },
"review": { "reviewer_id": "usr_55", "decision": "edited", "timestamp": "2026-11-05T09:20:01Z" },
"usage": { "input_tokens": 1840, "output_tokens": 312, "cost_usd": 0.0041, "latency_ms": 2210 },
"integrity": { "prev_hash": "a91f03...", "hash": "c2d7ee..." }
}The values are illustrative. The shape is what matters: every field answers a question a reviewer is likely to ask.
Storage and integrity
- Append-only: write events to a store or table where updates and deletes are not permitted for normal roles. Corrections are new events that reference the old one.
- Tamper-evident: chain each record's hash to the previous one, or periodically anchor a hash of recent records in a separate system, so alteration is detectable.
- Separate from product logs: audit data has different access, retention and integrity needs than debugging logs.
- Access controlled and itself audited: who reads the audit log should be recorded too.
Privacy and retention
An audit log that stores every prompt and response in full may collect more personal data than the product itself. If you handle personal data of people in Nigeria, the Nigeria Data Protection Act 2023 applies, and other regimes may apply to your clients. Practical defaults are to minimise what is stored, hash or redact where full text is not needed, restrict access, and set a documented retention period agreed with legal counsel rather than keeping everything forever.
Make it usable, not just compliant
Logs that cannot be queried are not much help in a review. Index by trace ID, tenant, actor, model version and prompt version, so questions like "show every output from prompt version 14 in October" take seconds. Pair the log with replay where possible: given the stored versions and inputs, can you rerun the call and compare?
This builds on the ideas in our piece on AI audit trails for regulator-adjacent clients. For tracing across multi-step calls, see debugging distributed traces across LLM calls, and for a production deployment, the ForgeObserver case study.
See also: tracing which model or prompt version caused a bad output.
Frequently asked questions
What is the difference between an audit log and an observability trace?
A trace is built for debugging and is usually sampled and short-lived. An audit log is built for accountability: complete for the events in scope, tamper-evident and retained according to policy.
Should I store the full prompt and response?
Only if you need to and are permitted to. Many teams store hashes plus redacted text, and keep full text only for categories of events where review requires it, with tighter access.
How do I handle model updates in the log?
Record the exact model snapshot on every event. If a provider changes behavior behind a stable alias, the snapshot field is what lets you separate that from your own changes.
Is an audit log required by law?
It depends on your sector and jurisdiction. Some regulated activities require records of automated decisions, and clients in regulated industries may require them contractually. Ask your compliance team or counsel.
The takeaway
An audit log earns its place by answering a reviewer's questions quickly: what ran, on what, with what context, who approved it. Record versions and identifiers rather than just text, store it append-only with integrity checks, and make privacy and retention explicit decisions.

Have a similar challenge?
Book a free 30-minute architecture call and we'll tell you honestly whether and how we can help.
Book Free Discovery Call →