Technical Guide

Storing full prompt text versus hashes in LLM audit logs

Neither option is correct on its own. Full prompt text gives the strongest record of what a model or agent was instructed to do, but it concentrates sensitive data in the log. Hashes limit exposure, but they cannot be read, searched semantically, or used to reconstruct an event.

Start with what the log must prove

The choice between full text and hashes should follow from the evidence the log needs to provide. Each option answers a different question.

  • Full prompt text gives the strongest record of what a model or agent was instructed to do, but it concentrates sensitive data in the log.
  • Hashes limit exposure, but they cannot be read, searched semantically, or used to reconstruct an event.

Comparing logging approaches

Prompt logging is a spectrum rather than a binary choice. At one end, full text offers the highest forensic fidelity and the highest data exposure. At the other, metadata only offers the lowest exposure and the least investigative detail.

A spectrum of prompt logging approaches, from most to least content retained
ApproachDescription
Full textHighest forensic fidelity and highest data exposure.
Redacted or tokenizedContent is kept with sensitive fields removed or replaced.
Encrypted, restrictedFull content is stored, but reading it requires controlled key access.
Keyed hashProves a known text matches a record without exposing the text.
Metadata onlyLowest exposure and the least investigative detail.

Where hashing falls short

A keyed hash can prove that a known text matches a record without exposing the text. That is useful, but a hash alone has clear limits. It cannot be:

  • read by an investigator;
  • searched semantically; or
  • used to reconstruct an event.

If hashing is used, it matters whether the hash is keyed or salted, and who controls and rotates the keys.

Hybrid designs and their tradeoffs

Because each approach trades exposure against investigative detail, most enterprises are better served by a tiered design that applies different treatment to different records.

  • Every request: broad metadata and keyed hashes.
  • Selected requests: full content captured selectively, encrypted, access-restricted, and retained for a defined period.

The tradeoff is that full content, wherever it is kept, still concentrates sensitive data, so encryption, access restriction, and tiered retention or deletion become part of the design.

Where runtime governance fits

For AI agents, the audit record is more useful when policy decision outcomes are linked to the prompt record, and when tool calls are logged with enough detail to reconstruct what was requested and what was allowed. The checklist below lists the capabilities to look for when evaluating governance tooling.

Audit log capabilities to evaluate in governance tooling

  • Can content capture be configured per application, field, or data classification as full text, redacted, hashed, or metadata only?
  • Are policy decision outcomes recorded and linked to the prompt record?
  • For agents, are tool calls logged with enough detail to reconstruct what was requested and what was allowed?
  • What tamper-evidence mechanisms protect the log, and can they be verified independently?
  • If hashing is used, is it keyed or salted, and who controls and rotates the keys?
  • How are encryption, access restriction, and tiered retention or deletion applied to stored content?

Review your audit logging design

Talk through prompt capture, retention, and policy enforcement records for your AI agents with a Trussed AI expert.

Talk to an Expert