Skip to main content

One Audit Log for Humans and AI — Why Separating Them Is a Compliance Mistake

Changes from the admin UI, scripts, or AI agents land in one audit log with the same identity fields. Why splitting human and AI audit is a mistake.

  • compliance
  • audit
  • ai
  • governance
  • operations
Zerq team

When compliance teams ask for an audit trail, they have a specific question in mind: "who changed what, when, and was it authorised?" That question does not care whether the person who made the change was sitting at a browser, running an automation script, or asking an AI assistant to do it. The change happened. It needs to be in the record.

The operational temptation when AI tooling is introduced is to route AI-initiated changes through a separate audit mechanism — a different log table, a different retention policy, or simply no audit trail at all because "it is just a tool." This is a compliance mistake. Separating human-originated changes from AI-originated changes creates exactly the kind of gap that compliance reviews and forensic investigations are designed to expose.

Zerq's audit model is built around one principle: an audited change produces the same record in the same trail, whichever surface it came through: the management console, a script calling the management API, Management MCP from an IDE, or Copilot.

What goes in the management audit log

The management audit log records configuration changes to the platform. Not API traffic (that is a separate log). The audited operations are defined as rules, one per management API route, and cover:

  • Collections created, updated, enabled or disabled, deleted, or imported from OpenAPI
  • Proxies created, updated, or deleted, and workflow definitions saved
  • Policies created, updated, enabled or disabled, or deleted
  • Clients created, updated, enabled or disabled, or deleted
  • Access profiles created, updated, or deleted, their auth type changed, and their credentials rotated or revealed
  • Stored credentials created, updated, deleted, or revealed
  • AI gateway configuration: providers, models, guardrails, budgets and settings, and profile AI keys issued or revoked
  • Request log and AI log deletions, and audit log exports

Ordinary reads (listing or viewing configuration) do not create entries; revealing a stored secret does. User accounts and role assignments are not on the list because they live in your identity provider, whose own admin log covers them.

Each audited request produces an entry with the same fields, whichever surface sent it. This is Alice raising the rate limit on the Payments Standard policy from the console:

{
  "id": "69d3c3f1a7c45e0b91d23f84",
  "timestamp": "2026-04-06T14:32:17.441Z",
  "actor_id": "[email protected]",
  "actor_type": "modifier",
  "resource_type": "policy",
  "action": "update",
  "ip_address": "10.20.4.37",
  "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
  "request_id": "c6916858-5b6b-4ab7-9171-05dfe3af399e",
  "trace_id": "598f28ba85ae0daa6d2bf85a0344fe50",
  "metadata": {
    "url": "/api/v1/policies/66f0c2a91d4e8b3f7a5c1e92",
    "request_body": "{\"name\":\"Payments Standard\",\"description\":\"Default policy for payments partners\",\"active\":true,\"rate_limit_interval\":\"1m\",\"rate_limit_requests\":750,\"quota_interval\":\"30d\",\"quota_requests\":1000000}",
    "response_body": "{\"id\":\"66f0c2a91d4e8b3f7a5c1e92\",\"name\":\"Payments Standard\",\"active\":true,\"rate_limit_interval\":\"1m\",\"rate_limit_requests\":750,...}",
    "status_code": 200
  },
  "created_at": "2026-04-06T14:32:17.441Z",
  "seq": 48213,
  "prev_hash": "4ec93554042242284cee6f0151624647ef115bd80cd0774518a5243ea7734ab0",
  "hash": "a166ab00400308dade4960ae406c13df44ef19aeedf1a7a5f0340a7408414444",
  "key_id": "9389f6c1c6621a00"
}

actor_id is the email claim on the caller's token, and actor_type is the roles on that token, comma-joined. The policy ID travels in metadata.url. request_body is what was submitted and response_body is what the API returned, here the policy as saved; secret fields such as credential passwords and profile tokens are masked as [REDACTED] in both. The entry does not hold a before-and-after diff: the previous value is in the previous entry for the same metadata.url. trace_id is filled in when tracing is enabled. seq, prev_hash and hash chain each entry to the one before it (HMAC-SHA256 when a chain key is configured, which key_id names), so an altered or missing entry shows up when the chain is verified.

There is no field that names the surface. What tells actors apart is identity, with the address and user agent as supporting context.

Three surfaces, one record

The admin console

Alice signs in to the management console, opens the policy, and changes the rate limit from 500 to 750 requests per minute. The console calls the management API with her access token, and the entry above is written: her email in actor_id, her roles in actor_type, her browser's user agent and address, and the submitted change.

This is the baseline case everyone expects. The audit record answers: Alice changed the Payments Standard policy rate limit at 14:32.

Scripts and automation on the management API

Your CI/CD pipeline calls the management API to apply a configuration change as part of a deployment. A platform engineer runs a script to update rate limits across 20 policies. An integration test suite creates a collection, exercises it, and tears it down.

The management API accepts the same OIDC bearer tokens as the console, issued by your identity provider. So a pipeline gets an identity there too, for example [email protected], and every audited change it makes produces the same entry as a console change: that identity in actor_id, its roles in actor_type, the HTTP client's user agent (curl/8.5.0, python-requests/2.32.3) and the runner's IP address.

Identity is the reliable way to tell these entries apart, so give each automation its own identity rather than borrowing a person's. Because actor_id comes from the token's email claim, make sure tokens issued to that identity carry a distinct email address (for a service-account client, a claim mapper can set one). A dedicated role name helps as well: map a role such as platform-automation into the modifier roles, and actor_type separates pipeline changes from people's at a glance.

This matters because automation often runs when no human is at a keyboard — deployment pipelines run overnight, scripts run on schedules. Without API-originated changes in the audit trail, you have gaps: "there was no change on Tuesday evening" when actually a deployment applied three policy updates at 02:00.

Management MCP and Copilot

An operator asks Zerq Copilot for Management: "Raise the rate limit on the Payments Standard policy to 750 RPM." Copilot runs in the console's server and calls Management MCP tools with Alice's own access token, the same one her console session uses. The update_policy tool sends PUT /api/v1/policies/66f0c2a91d4e8b3f7a5c1e92 with the new value to the management API, which checks Alice's roles and writes the entry. A developer using Management MCP from an IDE takes the same path with their own token.

Had Alice made her change through Copilot, these are the identity and request fields of the entry:

{
  "id": "69d3d9d652c935618fd26584",
  "timestamp": "2026-04-06T16:05:42.118Z",
  "actor_id": "[email protected]",
  "actor_type": "modifier",
  "resource_type": "policy",
  "action": "update",
  "ip_address": "127.0.0.1",
  "user_agent": "Go-http-client/1.1",
  "request_id": "47cbc255-a0c0-4e18-9788-f7ed7a21fc1e",
  "trace_id": "008f39a4872557ee159b57201b49e013",
  "metadata": {
    "url": "/api/v1/policies/66f0c2a91d4e8b3f7a5c1e92",
    "request_body": "{\"rate_limit_requests\":750}",
    "response_body": "{\"id\":\"66f0c2a91d4e8b3f7a5c1e92\",\"name\":\"Payments Standard\",\"active\":true,\"rate_limit_interval\":\"1m\",\"rate_limit_requests\":750,...}",
    "status_code": 200
  }
}

The audit record does not say "an AI did this." It says Alice did this, at 16:05, with her roles. The Go-http-client/1.1 user agent and the address of the internal hop from Management MCP to the management API (here 127.0.0.1) show the change came through Management MCP. Copilot and an IDE client look the same in the entry, because in both cases Alice acted through Management MCP with her own token. Where you need to know which, the console's server writes a structured ai_copilot_request log line for each Copilot request (the user, the model, the tools it called), and with tracing on, trace_id ties the audit entry to the Management MCP request in your trace backend.

This is the correct model for AI-assisted platform changes. The identity is Alice's. The authorisation was Alice's role. Copilot was the surface through which Alice acted, the same way the console is the surface through which she acts when she clicks through it. The assistant does not get an identity of its own in the audit log; it acts under the authenticated user's identity with the authenticated user's permissions.

Unattended agents are different. An agent that runs on a schedule, with no person approving each step, is automation: give it its own identity in your IdP, like the pipeline above, so its changes carry its own actor_id and actor_type.

Why separating human and AI audit records is a compliance mistake

It creates two sources of truth for the same question

If you have one audit trail for UI changes and a separate log for AI-initiated changes, the answer to "show me all changes to the Payments Standard policy in Q2" requires querying two systems, reconciling their formats, and merging the results. Any compliance query that spans both surfaces requires manual work that introduces errors and gaps.

Under SOX, SOC 2, PCI DSS, and most financial services audit frameworks, "show me all changes to production configuration in this period" needs to produce a complete, unambiguous record. "Here is most of it, and here is a separate file for the AI-initiated changes" is not a complete record.

AI-initiated changes need human accountability, not AI accountability

The right framing for AI-assisted platform management is not "the AI changed the configuration." It is "Alice, authorised by her modifier role, used Copilot to change the configuration." The accountability is human. The audit record should reflect that.

When a compliance auditor asks "who authorised this rate limit change?", the answer should be "Alice, at 16:05, using modifier permissions" — not "Copilot did it at 16:05." The first answer has accountability. The second creates ambiguity about who bears responsibility and whether the change was authorised through an appropriate human decision.

A unified audit trail with the human actor as the identity on Copilot-initiated changes resolves this cleanly. The AI assistant is a tool Alice used. The audit record shows Alice's decision, not the tool's invocation.

Separation enables audit evasion

This is the uncomfortable point: if AI-initiated changes are not in the main audit trail, a bad actor who gains access to an AI assistant and uses it to make configuration changes has a lower-visibility path than one who uses the UI directly. UI changes appear in the primary audit trail that compliance teams review. AI changes, in a separate or absent audit trail, may not be reviewed at all.

A unified audit trail eliminates this asymmetry. The console, the management API, Management MCP and Copilot all write to the same trail with the same retention and the same access controls. There is no lower-visibility path.

A shared admin token is a shadow admin plane

The lower-visibility path rarely starts with bad intent. A platform engineer automates catalog operations: creating collections for new products, updating workflows, provisioning partner access. The script needs credentials, so they create a service account token with broad admin access and drop it into a CI/CD variable or a local config file. Later the same token is wired into an AI assistant in the team's IDE. The assistant can now list, create, update, and delete platform resources with admin permissions, no connection to the identity provider that governs human access, and no audit entry that separates what it did from what a script or a person did.

When an auditor asks "who changed this workflow definition on Tuesday?", the answer is "the service account," which tells them nothing. SOC 2, ISO 27001, HIPAA, and FedRAMP share a common requirement: every privileged action must be attributable to an authenticated identity, with evidence of what that identity was permitted to do. A shared token fails twice. Attribution is impossible, because several agents, scripts, and humans may hold it. Separation of duties is absent, because a viewer should read configuration without changing it and an auditor should read the audit log without touching live config, yet an admin token grants everything. It is the same anti-pattern as giving every employee admin access.

Same OIDC, same RBAC for AI agents that manage the platform

The fix is not to block AI from platform management. It is to give AI agents no side door. The same principle that keeps Copilot changes under Alice's identity applies to agents that manage the platform directly, for example through Zerq's Management MCP from an IDE, which uses the same OIDC authentication and RBAC as the admin console:

  • Same identity provider. The agent presents a token issued by your IdP, with the same structure, expiry, and claim validation as a human operator's. There is no separate "AI credentials" concept, and the management API has no admin key of its own to share: it accepts bearer tokens from your IdP.
  • Same roles. The agent gets the role a human with equivalent responsibilities would get. A read-only assistant gets viewer permissions; an automation that creates collections gets modifier permissions. Neither gets admin by default.
  • Same audit log. Every audited change the agent makes lands in the management audit log with the email claim on its token as actor_id and its roles as actor_type, alongside console, script, and Copilot entries.

Because Management MCP calls the same management API endpoints as the console, through the same authentication middleware and the same role checks, you get one auth model by construction rather than by policy. The compliance question shifts from "can we allow AI to manage this?" to "what role level is appropriate for this automation?", which is a tractable operational question.

To find out whether a shadow admin plane already exists in your setup, check whether:

  • your management API validates tokens from your corporate IdP or accepts a separate set of service account credentials
  • AI agents and scripts use the same token type and role model as human operators, or a shared admin key
  • an agent's create or update actions appear in the same audit log your compliance team queries
  • you can revoke an agent's access by revoking its token at the IdP, the same way you offboard a human operator

If the answers are inconsistent, the gap is already there.

The forensic scenario: "who changed this policy?"

The practical value of a unified audit log is most visible in the forensic scenario. Something has gone wrong. A rate limit that should have been 500 requests per minute was 750 during the incident window. The question is: who changed it, when, and was that change authorised?

With a unified audit log, an auditor runs one query, in the console's Audit Logs screen or against the API (the audit endpoints require the auditor role):

GET /api/v1/audit/logs?resource_type=policy&action=update&url=66f0c2a91d4e8b3f7a5c1e92&start_date=2026-04-01T00:00:00Z&end_date=2026-04-06T23:59:59Z

The result is every update to that policy in the window, whether it came from the console, a script, Management MCP, or Copilot. Each entry has the actor's email and roles, the submitted change, the policy as saved, and the user agent and address the request came from; the entry before it for the same URL shows the earlier values. Drop action=update to see the policy's status toggles and deletion in the same list.

With a fragmented audit trail, the same question requires checking multiple systems, possibly finding that one of them has no record (Copilot changes were not retained in the same system), and being unable to provide a complete answer.

The forensic question "who changed this?" should always have a single, complete answer. That requires a single audit trail.

What the audit record enables beyond forensics

The unified audit log is not just for incident investigation. It supports:

Quarterly access reviews. The audit log shows which identities (human operators and automation identities) made changes in the review period, by actor_id and actor_type. Identities that appear in the audit log but are no longer active employees or approved integrations are candidates for deprovisioning in your IdP.

Change velocity monitoring. How many configuration changes were made in a given period? A spike in change frequency (more changes in one day than in the previous month) is an anomaly worth investigating.

Role compliance verification. A viewer can read configuration but not change it, and the audit log is where you verify that. An audited change a viewer attempts is recorded with status_code 403 and the viewer's identity and roles, so filtering on status code 403 lists every denied change attempt and who made it: evidence that RBAC is enforced, and a signal worth following up.

Regulatory evidence packaging. When a regulator asks for evidence of change management controls — "show us that configuration changes go through an approval process and are logged" — the audit trail is the primary evidence. The auditor exports the filtered trail as CSV or NDJSON with its hashes, the export is itself recorded (resource type audit_log, action export), and Verify integrity checks the chain for altered entries and gaps in the sequence. A complete, consistent trail is audit-ready evidence. A fragmented trail requires manual assembly.


Zerq's management audit log records audited configuration changes from the console, the management API, Management MCP, and Copilot in a single structured trail with the same identity fields. See Monitoring & Analytics for the full observability capability, or request a demo to walk through how the audit trail integrates with your compliance review process.