Skip to main content

Admin audit log

Schema: migration 11.
The mutating admin actions listed under “Action naming convention” below — API-key creation, update, rotation and revocation, provider-key validation, customer-managed-key register, rotate and revoke, prompt promotion and canary, account email change — each write one row to admin_audit_log (Postgres). Other admin actions are not recorded in this table. The row captures the actor, the target, before/after JSON snapshots, the request IP, and the user agent. The table is indexed for the most common query: “show me everything that happened to this workspace in the last 30 days.”

Schema at a glance

Indexes:
  • idx_admin_audit_workspace (actor_workspace_id, occurred_at DESC) — workspace-scoped scan
  • idx_admin_audit_target (target_type, target_id, occurred_at DESC) — “what ever happened to this resource”

Action naming convention

<target>.<verb>. The verb is lowercase + concise; the target groups related actions. Recorded actions:

Querying the log

”What did I do to this workspace in the last 30 days?"

"What ever happened to this specific resource?"

"Who is changing things from outside our office IPs?”

What the log is, and is not

Is: A durable record of who did what in the dashboard / gateway control surface — the table you query during an internal incident review. Is not: The tamper-evident agent event ledger That ledger captures the runtime behaviour of customer agents (LLM calls, tool calls, guardrail decisions) with a tamper-evident SHA-256 hash chain and customer-runnable verifier CLIs (Ed25519 batch signing
  • Sigstore Rekor v2 anchoring live, best-effort, on every plan). The admin audit log is the application-control mirror — a separate, simpler promise backed by Postgres + indexes, not by cryptographic anchoring.

Retention

There is no automated retention or archive job for this table. It is expected to grow ~100 rows/workspace/day at active use, ~36 K rows per workspace per year — well within Postgres comfort.

Coverage

Not every admin endpoint writes to this table; the actions listed above are the ones recorded.

Failure mode: write failure does not fail the request

recordAdminAction() (TypeScript, apps/web/lib/admin-audit.ts) is best-effort: a Postgres blip writes a console.error line and lets the calling route succeed. Rationale: we’d rather lose one audit row than return a 5xx to the user on a transient connection error. Operators tail the error log to catch sustained write failures.