query tool to an append-only NDJSON (newline-delimited JSON) file. This gives you a full audit trail of what the AI asked your database.
Enabling audit logging
Use the--audit-log CLI flag:
NDJSON schema
Each line is a JSON object with these fields:| Field | Type | Description |
|---|---|---|
ts | string | Timestamp in RFC 3339 format (UTC) |
tool | string | Tool name: "query" |
sql | string | The SQL statement that was executed |
rows_returned | integer | Number of rows in the result |
duration_ms | integer | Execution time in milliseconds |
error | string | null | Error message if the query failed, null on success |
Example log entries
Analyzing logs with jq
Notes
- Audit logging is best-effort — if a write to the log file fails, the query still completes. This ensures audit I/O never blocks your database queries.
- Only
querytool calls are logged (including queries withexplain: true). Schema discovery tools (discover,describe_table) are not logged since they don’t execute user-supplied SQL. - The log file is opened in append-only mode. Isthmus never truncates or rotates the file — use external log rotation (e.g.
logrotate) for long-running deployments.