Vaikora › Blog › Product Updates
AI agent audit logs: what has to be in each record for the log to be usable in an investigation
Audit logs that record "agent called tool X at 14:32" tell you almost nothing when something goes wrong. A usable investigation record needs the input, the policy decision, the enforcement outcome, and the chain of custody, all in a single entry, with no gaps between events.
This is where most AI agent audit implementations fall short. They log at the application layer, after the fact, and they omit the intermediate state that an investigator actually needs: what the agent sent, what policy matched, what modification or block was applied, and whether the record itself can be trusted.
What a complete audit record looks like
Each entry in a defensible AI agent audit log needs at minimum:
- The raw request, not just a summary. The exact payload the agent attempted to send to an LLM or tool, before any policy modification.
- The policy that matched. Which rule triggered, what its configured threshold was, and why this specific request triggered it.
- The enforcement decision. One of four outcomes: allow, block, modify, or require-approval. Not a free-text note. A deterministic, machine-readable field.
- The post-decision payload. If the action was modified before execution, the log needs both the before and after states so you can see exactly what changed.
- A timestamp with enough precision to reconstruct ordering. If two agents act on the same resource within the same second, record order matters.
- Caller identity. Which agent, which session, which tool call initiated the action.
A log that records only the final outcome cannot answer the question an investigator always asks first: what did the agent actually try to do?
The chain-of-custody problem
Logs have no value in an investigation if they can be altered. This is not a hypothetical concern. If an agent can write to the same log store it is being audited against, or if the log store has no tamper detection, an attacker with access to the agent can erase or rewrite entries to cover lateral movement.
The standard answer to this is hash chaining. Each log entry includes the SHA-256 hash of the previous entry. Any deletion or modification of a record breaks the chain at that point, and the break is detectable on inspection. Vaikora writes every enforcement decision into a SHA-256 hash-chained, tamper-evident log exactly this way. When you pull a log segment for investigation, you can verify the chain is intact before you rely on the records.
This matters most when the investigation concerns actions the agent took over an extended period, not a single event. If records are missing, you need to know they are missing, not discover it later.
A concrete example: a modify decision
Say an agent submits a prompt to an LLM that includes a customer email address embedded in a tool call argument. The policy rule says: redact PII from outbound LLM requests. The enforcement point intercepts the request, replaces the address with a placeholder, and allows the modified request to proceed.
The audit log for that event needs four things: the original payload (including the raw email address), the rule ID that matched, the modified payload (with the redacted field), and the allow decision on the modified version. If the log only records "PII detected, request allowed," you cannot reconstruct what the agent sent, what was changed, or whether the redaction worked correctly.
If the same agent sends the same payload an hour later and the log shows a different decision, that is a signal worth investigating. With deterministic policy enforcement, identical input always produces an identical decision. A divergence means something in the environment changed, and the log should let you identify what.
Connecting log records to your existing security tooling
Log records sitting in an isolated audit store are harder to act on than records surfaced in the tools your team already works in. This is why Vaikora pushes AI agent threat signals into Microsoft Sentinel, SentinelOne, CrowdStrike Falcon, and AWS Security Hub natively, with severity mapping applied at the point of export so analysts see AI agent risk in the same queue as other endpoint and network signals.
The practical effect is that a high-severity policy violation from an AI agent (a credential exfiltration attempt, for example) appears in SentinelOne as a Threat Intelligence indicator at severity 100 without any custom pipeline work. An analyst can correlate it against other activity in the same session without switching tools.
What to check in your current setup
Before your next agent deployment goes into production, verify three things in your audit configuration:
- Pull a sample log segment and check whether each record contains the raw pre-enforcement payload. If it only has the post-decision state, you have a gap.
- Test for tamper detection. Delete or modify a single record and confirm the system flags the broken chain. If it does not, the log is not hash-chained in any meaningful way.
- Confirm that enforcement decisions use a fixed vocabulary (allow, block, modify, require-approval) and that the field is indexed for query. Free-text outcome fields make bulk analysis across thousands of events impractical.
If any of those three checks fail, start there. The chain-of-custody and the pre-enforcement payload are the two things you will wish you had when an investigation is already underway.
See Vaikora enforce policy on your AI
Open-core AI runtime control. Self-host the MIT gateway free, or run the hosted Control Plane.
Get a demo Self-host the gateway
Vaikora