DEV Community

Mads Hansen
Mads Hansen

Posted on

Your AI database audit log should not become a second database

An audit log should explain what happened.

It should not quietly become a second database containing every row the AI was allowed to see.

That is the evidence problem behind many ChatGPT-to-database rollouts.

Teams need enough information to answer:

  • who requested the data?
  • which identity and policy applied?
  • what source and business definition were used?
  • were row, field, and byte limits enforced?
  • was the result fresh, complete, or truncated?
  • what reached the database?

They usually do not need every returned row copied into prompts, traces, tickets, and observability tools.

A better receipt records identity, tool and policy versions, normalized filters, source, freshness, row and byte counts, redaction decisions, structured outcome, and a trace reference.

Keep raw result capture separate:

  1. require an explicit debugging purpose
  2. restrict who can capture and read it
  3. redact before persistence
  4. scope it to the minimum rows and fields
  5. give it an automatic expiry
  6. track every downstream copy

Two details matter more than they first appear.

First, remove sensitive literals from query fingerprints. Email addresses and account IDs do not become safe just because they are inside SQL text.

Second, do not assume hashing solves the problem. Low-entropy values can be guessed, and stable hashes can become identifiers of their own.

The useful split is:

  • the AI-layer receipt explains intent, policy, and result shape
  • database-native evidence proves what reached the data system

Together they provide an audit trail without turning telemetry into another store of customer data.

Full guide: ChatGPT Enterprise database connection: retain evidence without retaining the data

Top comments (1)

Collapse
 
debashish_ghosal profile image
Debashish Ghosal

Wow! This is a fantastic post and thought provoking one. I have not looked into it but I am thinking more. Have you come across tools that can process the logs and make it more AI aka agent ready? Has any of the popular databases started doing anything to make the logs more AI friendly? This would be a tremendous boost to many engineers, and drive action

Thanks for posting this