Research Home Topics AI Audit Countries Sources Calendar Methodology Authors
AI Audit

AI Audit Trails: What to Log, How Long to Keep It, and Why It Matters

An AI audit trail is the recorded evidence that an AI system operated within its authorised scope, made the decisions attributed to it, and produced the outputs documented. Without an adequate audit trail, post-incident investigation is impossible, regulatory inspection cannot be answered, and internal governance is unverifiable. Article 12 of the EU AI Act sets mandatory logging requirements for high-risk AI systems. This article covers what to log, for how long, and how to maintain audit trail integrity.

Key context
"An audit trail is only useful if it is complete, immutable, and interpretable. A log that records what the system did but not why it did it fails the purpose of AI accountability."
AGNUS Research · EU AI Act Articles 12, 72
An audit trail is not a nice-to-have. For any AI system that makes consequential decisions, the audit trail is the only post-facto evidence of what actually happened — as distinct from what the system was designed to do.

Builds on AR-000151 (Logging & Record-Keeping, Article 12), which covers the EU AI Act Article 12 logging obligation in full. This article covers the broader practice of AI audit trail design, applicable across all AI systems regardless of classification. See also AR-000460 (Prompt Injection) for how audit trails support security incident investigation.

What an AI audit trail is

Article 12 requirements for high-risk AI

What to log: the complete field set

Field Description Requirement level
session_id Unique identifier for each use session. Links all events within a single interaction. Mandatory (Article 12(2)(a))
timestamp_start / timestamp_end Start and end time of each use. ISO 8601 format with timezone. For high-risk AI systems under Article 12(2)(a). Mandatory (Article 12(2)(a))
model_id / model_version The exact model and version that processed the request. Critical for investigation when model updates change behaviour. Mandatory (Article 12(1) traceability)
input_data The input to the model. For personal data: hash or reference only (GDPR minimisation). For biometric systems: per Article 12(2)(c). Mandatory for biometric; recommended for all
output_data The model output, recommendation, or decision produced. For systems that produce scores or classifications: the score/class and confidence level. Mandatory (Article 12(1) traceability)
decision_taken The action taken based on the output (approved/rejected/referred). Captures the human decision where human oversight is required under Article 14.
human_reviewer_id Identifier of the natural person who reviewed/verified results. For biometric systems: mandatory under Article 12(2)(d). For all high-risk systems with human oversight: best practice. Mandatory for biometric (Article 12(2)(d))
tool_calls (agentic) For agentic systems: every tool called, inputs passed, outputs returned. The tool call log is the primary record of what the agent did in the world. Mandatory for agentic systems (governance best practice)
retrieved_content_refs (agentic) References to content retrieved from external sources and used as model context. Required for prompt injection investigation.
anomaly_flags Automated flags from anomaly detection: out-of-scope actions, confidence below threshold, deviation from baseline behaviour.
reference_database_id For systems that check inputs against a reference database (biometric, watchlist): the database version and reference used. Article 12(2)(b). Mandatory for biometric / reference-checking systems

Retention periods

EU AI Act (Article 12)
Provider-determined
Appropriate to the intended purpose
The Act specifies no single retention period. Providers must determine what is appropriate for their system type and document the determination in Annex IV technical documentation. The preamble references the period appropriate to post-market monitoring and incident investigation needs.
GDPR (personal data in logs)
Minimum necessary
Data minimisation principle (Article 5(1)(e) GDPR)
Personal data in audit logs must be retained only as long as necessary for the specified purpose. Where possible, logs should reference personal data by hash or pseudonymous identifier rather than raw personal data, to allow retention of the audit record without storing personal data indefinitely.
Incident investigation
3–7 years
Limitation periods for legal proceedings
Logs needed to support legal proceedings or regulatory investigations should be retained for the applicable limitation period in the relevant jurisdiction. In many EU member states, civil limitation periods run 3–5 years; some regulatory investigation periods run longer. Legal advice is required for the specific use case.

Audit trail integrity

Audit trails for agentic systems

The four uses of an AI audit trail

1. Internal governance review

2. Regulatory inspection

3. Post-incident investigation

4. Legal and adversarial proceedings

What organizations must do

  • For every high-risk AI system: implement the Article 12 mandatory fields (session period, model version, input data for biometric systems, reviewer identification for biometric systems). Document the retention determination in Annex IV technical documentation.
  • Design log architecture to separate the audit record (pseudonymous, retainable) from the personal data fields (subject to GDPR minimisation). Do not design a log where retaining the audit record requires retaining personal data indefinitely.
  • Implement append-only storage with access controls. No individual user should be able to modify or delete log entries. Implement hash-chaining or equivalent tamper-evidence on the log.
  • Log access to the audit trail itself: who queried the log, when, what they retrieved. This is the chain-of-custody record for the audit trail.
  • For agentic systems: extend the audit trail to every tool call and every external action. The audit trail must follow the agent’s action surface, not just the model’s I/O boundary.
  • Test inspection readiness annually: run a mock log-export exercise, verify that the exported records are complete and readable, and produce a chain-of-custody document for the export. Do not first test this when an inspection is imminent.
  • Schedule regular internal governance reviews of audit trail data: look for drift, boundary violations, and unexpected output patterns. Document findings and corrective actions.

Common mistakes

Logging only model inputs and outputs for agentic systems is the most common mistake. For an agent that calls tools and takes actions in the world, the model I/O log is a fraction of the audit record needed. Without tool call logs and external action logs, the audit trail cannot support post-incident investigation of what the agent did in the world.

Storing personal data indefinitely in logs because "we might need it" is a second mistake. GDPR data minimisation applies to personal data in audit logs. Design the log architecture so that the audit record (pseudonymous) can be retained while the personal data is deleted or further pseudonymised when no longer needed.

Treating audit trail integrity as a technical default is a third mistake. Append-only storage, access controls, and tamper-evidence must be explicitly designed and verified. A log stored in a mutable database table with no access controls provides no evidentiary assurance.

First testing log export capability when a regulatory inspection arrives is a fourth mistake. Audit trail export is a capability that must be built, tested, and maintained. Organisations that have never exported their logs for inspection have no assurance that the export will be complete, readable, or usable when needed.

Open questions

  • What the EU AI Office considers adequate for Article 12(1) traceability for non-biometric high-risk AI systems — no technical guidance has been published specifying the minimum log fields for employment, essential services, or other Annex III category systems beyond the Article 12(2) minimum.
  • How long Article 12 logs must be retained for specific system types — the Act specifies no retention period; provider determination is required. The AI Office may publish guidance.
  • Whether the Digital Omnibus amended Article 12’s logging requirements — the article is not confirmed as amended; check the current consolidated text.
  • How audit trail requirements interact with GDPR erasure rights (Article 17) — if a data subject requests erasure of their personal data and their data appears in an AI audit trail required for regulatory compliance, the interaction between the erasure right and the audit retention obligation is not clearly resolved in either regulation.

Frequently asked

FAQ
Does a non-high-risk AI system need an audit trail under the EU AI Act?
Article 12 applies to high-risk AI systems only. Non-high-risk systems have no statutory logging obligation under the EU AI Act. However, audit trails are a governance best practice for any AI system that makes consequential decisions. Organisations that deploy non-high-risk AI systems without audit trails have no post-incident investigation capability and limited ability to respond to complaints or disputes about the system’s decisions.
FAQ
Can audit trail logs contain personal data?
Yes, but GDPR applies. Personal data in audit logs is subject to data minimisation: retain only what is necessary for the logging purpose. Where possible, log pseudonymous references (a session ID that maps to a data subject in a separate, access-controlled mapping table) rather than raw personal data. The mapping table can be deleted when personal data retention is no longer required; the audit record with the pseudonymous reference can be retained longer to support governance, investigation, and regulatory inspection needs.
FAQ
Who is responsible for maintaining AI audit trails — the provider or the deployer?
Under the EU AI Act, Article 12 is a provider obligation: providers must build logging capabilities into the system. But Article 26(5) requires deployers to keep the logs generated by the system for a period appropriate to the intended purpose. Both parties have obligations: the provider builds the capability; the deployer retains the logs. In practice, the provider’s system design determines what is logged; the deployer’s retention and access-control policies determine how long it is kept and who can access it.

Go deeper

Apply this in practice

AGNUS Academy turns AI governance research into hands-on skills — exercises, case studies, and frameworks built on the research you just read.

Explore the Academy →