AI Audit Log Designer

Design an audit record for AI decisions and agent actions: JSON Schema, example, append-only PostgreSQL table, hash chain code and an EU AI Act logging checklist.

The interactive tool loads here when JavaScript runs.

About this tool

What is the AI Audit Log Designer?

Choose what your system should record for every AI decision or agent action, and this designer writes the JSON Schema for the record, a realistic example, a PostgreSQL table with append-only protections, a hash-chaining snippet in Node.js or Python, and a checklist mapped to the EU AI Act record-keeping articles and the NIST AI Risk Management Framework.

Start from a preset for a customer-support agent, a loan or insurance decision assistant, a coding agent or a healthcare documentation assistant, then switch fields on and off, decide whether inputs are stored in full, redacted or as a hash, and set a retention period. The example record is hashed in your browser with WebCrypto so you can see exactly what a chained record looks like.

  • Fourteen fields with explanations and four presets
  • JSON Schema draft 2020-12 matched to your choices
  • Example record hashed in the browser
  • PostgreSQL DDL with partitions, revoked updates and a blocking trigger
  • Hash chain write and verify code for Node.js and Python
  • Checklist referencing EU AI Act Articles 12, 19 and 26 and NIST AI RMF
Read the guide: Tracing LLM and Agent Apps with OpenTelemetry, Plus Audit Logs

Updated

How to use the AI Audit Log Designer

  1. Pick the preset closest to your system and give it a name.
  2. Tick the fields to record and choose how inputs and outputs are stored: full text, redacted text or a SHA-256 hash.
  3. Set the retention period and decide whether to chain records with hashes.
  4. Copy the JSON Schema to validate records in your application, and the SQL to create the table.
  5. Add the hash chain code to the single writer that appends records.
  6. Review the checklist: met, partial, gap or process items that the log design alone cannot cover.

Worked examples

Loan decision assistant

Input

Preset: loan or insurance decision assist; input as hash; 7 years; hash chain on

Output

Schema with input.sha256, human_approvals, policy_checks and record_hash; checklist shows retention met

Hashing the application keeps personal data out of the log while still proving which input was used.

Short retention

Input

Customer-support preset with retention set to 90 days

Output

Checklist item for Article 19(1) and 26(6) shows a gap

The Act sets a floor of six months for high-risk systems unless other law sets a different period.

Background and insight

Traces and audit logs answer different questions. A trace is for engineers: it is sampled, short-lived and shows timings. An audit record is for accountability: it is kept for every decision, retained for a set period and must show who or what acted, on which inputs, with which model and prompt version, what checks ran, who approved it and what happened as a result. Link the two with the trace id so an investigation can move from one to the other.

For high-risk AI systems, Article 12 of the EU AI Act (Regulation (EU) 2024/1689) requires that the system technically allows automatic recording of events over its lifetime, so that risks and substantial modifications can be identified and post-market and deployer monitoring are possible. Article 19 requires providers, and Article 26(6) requires deployers, to keep the logs under their control for a period suited to the purpose and at least six months, unless other Union or national law says otherwise. Article 12(3) lists minimum fields for remote biometric identification systems, including the start and end of each use and the people who verified the results. The NIST AI RMF is voluntary and organises the same concerns under its Govern, Map, Measure and Manage functions.

Common use cases

  • Preparing for a high-risk AI system

    Get a logging design in front of engineering and compliance before the system ships.

  • Agent accountability

    Record every tool call an agent makes with its arguments and result, and who approved it.

  • Incident review

    Reconstruct a bad decision from the model version, prompt version, sources and policy results.

  • Customer or auditor questions

    Show which records exist, how long they are kept and how tampering would be detected.

Tips and limitations

  • Use pseudonymous ids for actors and reviewers, not names or emails, and keep the mapping elsewhere.
  • An append-only table stops the application changing rows; it does not stop a database owner. Ship records to write-once storage or publish the latest hash somewhere separate.
  • Retention and append-only pull in opposite directions. Partition by month and drop whole partitions with a separate maintenance role.
  • Hash chains need a single, ordered writer. With many writers, keep one chain per partition key.
  • JSON number formatting differs between languages, so verify a chain in the language that wrote it.
  • The checklist only says whether the log design covers a point. It is not legal advice or a conformity assessment.

Frequently asked questions

What does EU AI Act Article 12 require for logging?

That high-risk AI systems technically allow automatic recording of events over their lifetime, with logs that help identify risks and substantial modifications and support post-market and deployer monitoring.

How long must AI system logs be kept under the EU AI Act?

For high-risk systems, providers (Article 19) and deployers (Article 26(6)) keep the logs under their control for a period suited to the purpose and at least six months, unless other EU or national law says otherwise.

Is an audit log the same as an LLM trace?

No. Traces are sampled engineering data kept for days or weeks. Audit records cover every decision, are retained for a defined period and focus on who, what, why and the outcome. Link them by trace id.

Should I store the full prompt in an audit log?

Only if you need it and can protect it. A SHA-256 hash proves which input was used without keeping personal data in the log; redaction keeps readable text with sensitive parts removed.

How does a hash chain make logs tamper-evident?

Each record stores the hash of the previous record and a hash of itself. Changing or deleting any record breaks every later hash, which a verifier detects.

When do the EU AI Act high-risk logging duties start to apply?

The Act originally applied most high-risk rules from 2 August 2026. Amendments push Annex III systems to 2 December 2027 and Annex I products to 2 August 2028. Check the current consolidated text.

Does the NIST AI RMF require audit logs?

It is voluntary guidance, not a regulation. Its Govern, Map, Measure and Manage functions call for documentation, monitoring and accountability that audit records support.

Is there an in-depth guide to the AI Audit Log Designer?

Yes. “Tracing LLM and Agent Apps with OpenTelemetry, Plus Audit Logs” covers the background, how it works, common pitfalls and worked examples. Read the full guide.