← Blog

LLM Audit Logging Best Practices: Building Records That Survive a Regulator

A compliant LLM audit log has to reconstruct which model decision touched which record, who initiated it, what was in the prompt, and what policy governed it. Application-written logs fail that test because the system under audit controls its own evidence. This piece lays out the practices that produce records an auditor can actually use: identity binding, per-decision granularity, tamper evidence, and independence from the calling app.

ByParminder Singh· Founder & CEO, DeepInspect Inc.
Compliance & Regulationai-auditllm-loggingcomplianceai-governanceaudit-trail

A regulator reviewing an AI decision asks a narrow set of questions. Which model call touched this file? Who initiated it? What was in the prompt? What policy was in effect at that moment? Can you produce, in writing, an immutable record showing all of it? A log that answers those questions is an audit log. A log that records "request processed at 14:03" is a diary entry.

Most LLM logging today produces the second kind. I want to walk through the practices that produce the first kind, and why several of them cut against how application logging is normally built.

Start from what the record has to reconstruct

An audit log is not a debugging log with the volume turned up. Its job is evidentiary: to let someone who was not there rebuild what happened with enough fidelity to stand up in a review. For an LLM call, that means each record carries the identity behind the request, the role and authorization in effect, the classification of the data in the prompt, the policy version that governed the decision, the outcome, and a timestamp precise enough to correlate across systems.

If you design the log from the storage schema up, you get whatever the application happened to have on hand. If you design it from the regulator's questions down, you get the fields above. The order matters.

Bind every record to an identity, not a service key

The single most common failure is identity. Enterprise AI calls usually authenticate with a static key issued to an application, so the log can name the service but not the human or agent on whose behalf the call was made. When the record has to identify the natural person involved, and most modern AI regulation asks for exactly that, a service-key log cannot supply it.

The practice is to attach identity context at the request layer and write it into every record. The person or agent, the role, the authorization scope. Without this, no amount of downstream log processing recovers who actually sent the prompt, because the information was never captured.

Make it per decision, not per session

Session-level logging tells you a user was active between two timestamps. It does not tell you that at 14:03:12 that user sent a prompt containing a customer's full record to an external model and the policy in effect redacted three fields. Regulatory questions are about specific events, so the record has to be per decision: one entry per model call, with the inputs and outcome of that call.

This is more data, and that is the point. The granularity is the evidence. A per-session summary is exactly the resolution that collapses under a pointed question.

Keep the log out of the reach of the system it audits

Here is the practice a committee would argue with: the system that makes the AI decision should not own the log that records it. When the application writes its own audit trail, three failure modes follow. It can log selectively and quietly skip its own edge cases. It can suppress or rewrite records after the fact. It can crash after the model responds but before the write commits, so the action happened and the evidence did not.

Self-attestation by the system under audit fails the traceability test. The record has to be produced by something the application does not control, and committed before the model's response returns to the application, so there is no window in which the action exists without the record.

Make records tamper-evident and retain them long enough

An auditor treats a mutable log as a convenience artifact, not a system of record. Standard application logs sit in a database the application can write, get rotated on a schedule, and carry no integrity guarantee. The practice is a cryptographic signature or equivalent integrity mechanism on each record, so a later change is detectable.

Retention follows the regulation, not the disk budget. The EU AI Act sets a floor of at least six months for automatically generated logs, and financial and healthcare record-keeping obligations push the real number to years. Design for a seven-year upper bound with the option to extend, and you will rarely be caught short.

Cover the AI you did not write yourself

A material share of enterprise AI runs inside vendor tools that embed model calls under the hood. The pricing engine scores risk with a model. The support platform summarizes tickets with an LLM. If your audit coverage stops at the applications your team built, those calls are invisible, and the disclosure obligation still lands on you as the deployer. The practice is to route sanctioned AI traffic, including the traffic your own apps generate toward third-party models, through one enforcement point that logs it uniformly.

DeepInspect

DeepInspect produces this record as a property of the request path. It sits as a stateless proxy between your applications and any LLM, evaluates each call against per-route and per-role policy using the identity context supplied, and writes a per-decision audit record holding identity, role, policy version, data classification, outcome, and timestamp.

The record is tamper-evident and is committed before the response returns to the application, which closes the suppression and crash-loss gaps by construction. Because every sanctioned model call passes through the same point, the coverage extends to the vendor-embedded and agent-driven traffic that application logging misses.

If your AI audit readiness rests on logs the application controls, book a compliance mapping session and we will show you where the evidence gaps are before an auditor does.

Frequently asked questions

Is application logging ever enough for AI audit requirements?

For low-stakes internal use with no regulatory exposure, application logs may be all you need. Once an AI decision falls under a regime that asks who was involved, what data was processed, and what governed the decision, application-controlled logs stop being sufficient, because the system under audit both makes the decision and owns the evidence. The failure is structural rather than a matter of logging more fields. The fix is an independent record, not a more detailed application log.

What fields belong in an LLM audit record?

At minimum: a verified identity for the person or agent behind the request, the role and authorization context in effect, the classification of the data in the prompt, the policy version that governed the decision, the outcome such as permit, redact, or deny, and a timestamp precise enough to correlate with other systems. A cryptographic integrity marker belongs on each record so later tampering is detectable. Everything beyond that is useful context, but those fields are what turn a log line into evidence.

How long do we have to keep AI audit logs?

The EU AI Act sets a floor of at least six months for the automatically generated logs of high-risk systems, and other law can require longer. Financial institutions commonly face five to ten year record-keeping obligations, and healthcare retention depends on the data type. The practical planning number for a regulated organization is years, not months, so architect the store to hold seven years with room to extend rather than to the six-month minimum.

Does per-decision logging create too much data to manage?

Per-decision records are more voluminous than session summaries, and that volume is the evidence you are required to have. The manageable version routes the records to storage designed for append-heavy, long-retention data rather than the operational database, and keeps the hot query path scoped to recent windows. The cost of storing per-decision records is small next to the cost of not being able to answer a regulator's question about a specific call.

How do we log AI usage that runs inside third-party SaaS tools?

You cannot log inside a vendor's product, but you can require, in the procurement contract, that the vendor provide the audit records for AI decisions made on your data and produce them on demand. For the model traffic your own applications send toward third-party models, routing it through a single enforcement point gives you a uniform record regardless of which model sits on the other end. The gap to close first is usually the embedded vendor AI nobody has inventoried yet.