Skip to content

Audit Log

The Audit Log records every state-changing event in PromptGate: logins, credential CRUD, token CRUD, endpoint CRUD, guardrail toggles, OAuth flows, backups, and more. Append-only by convention (no UI to delete), filterable by time / event / project, exportable as CSV.

A non-exhaustive index of audit event keys:

EventWhen
auth.loginSuccessful login
auth.login_failedWrong password / unknown user
auth.logoutUser logged out
auth.token_invalidAPI request with bad token
auth.scope_missingAPI request with token lacking required scope
EventWhen
project.created
project.updated
project.deleted
EventWhen
endpoint.created
endpoint.updated
endpoint.deactivated
api_gateway_endpoint.created
api_gateway_endpoint.updated
EventWhen
credential.created
credential.updated
credential.deactivated
credential.deleted
EventWhen
token.created
token.rotated
token.revoked
token.deleted
EventWhen
guardrail.enabledToggled on (project / global)
guardrail.disabledToggled off
guardrail.blockedA request was blocked by a guardrail
EventWhen
provider.enabled
provider.disabled
EventWhen
mcp_server.created
mcp_server.updated
mcp_server.deactivated
EventWhen
oauth_connection.created
oauth_connection.connect_initiatedUser clicked “Connect”
oauth_connection.connectedToken exchange succeeded
oauth_connection.callback_errorProvider returned error=...
oauth_connection.exchange_failedToken exchange HTTP failure
oauth_connection.disconnectedTokens cleared
oauth_connection.deleted
EventWhen
webhook.created
webhook.test”Send test” button used
EventWhen
backup.exportedA ZIP was downloaded

Control Plane (write tools, tagged via=mcp_control_plane)

Section titled “Control Plane (write tools, tagged via=mcp_control_plane)”
Event
control_plane.project.created
control_plane.token.created
control_plane.token.rotated
control_plane.token.revoked
control_plane.endpoint.activated
control_plane.endpoint.deactivated

The via=mcp_control_plane metadata distinguishes agent-driven mutations from UI ones — useful for spotting “did the agent break this, or did a human?”.

Each row in audit_logs:

uuid | "0e2f...c4"
event | "credential.created"
severity | "info" | "ok" | "warn" | "err"
actor_label | "admin@promptgate.dev" (display name from session)
actor_user_id | 1 (FK or null for system / API)
project_id | 7 (or null for global events)
target | "OpenAI Production" (the affected resource)
metadata | {"slug": "openai-production"} (JSON, free-form)
ip_address | "10.0.0.42"
created_at | "2026-05-06T10:14:22Z"

Top-right user menu → Audit Log.

The page has:

  • A searchable table sorted DESC by created_at.
  • Time-range filters: Today, 7 days, 30 days, All.
  • Free-text search across event, actor_label, target.
  • Severity colour coding (info / ok / warn / err).
  • One-click Export CSV for the current filter.
  • Audit failed logins last 24h: time = Today, search = login_failed.
  • What did the admin agent change today: search = via=mcp_control_plane.
  • OAuth flow troubleshooting: search = oauth_connection.
  • Find a deleted credential: search = credential.deleted.

The export endpoint streams a CSV:

GET /audit/export?since=2026-05-01&until=2026-05-06

(Same filters as the UI — passed as query params.) Returns one row per event with all columns. Useful for piping into a SIEM or running ad-hoc analysis.

By default, forever. The audit_logs table grows with usage; for high-traffic gateways you may want to prune occasionally:

Terminal window
docker compose exec app php artisan tinker
\App\Models\AuditLog::query()->where('created_at', '<', now()->subYear())->delete();

Configurable retention policies (auto-prune at N days) are on the roadmap.

Every audit insertion fires matching webhooks. So you can get real-time notifications by registering a webhook with the matching event subscriptions — see Webhooks.

The Community Edition lets the admin run arbitrary SQL via Tinker, and the schema doesn’t prevent UPDATE / DELETE. We don’t claim it’s tamper-proof — the goal is observability + accountability for an honest single-admin deployment, not a forensic guarantee against the admin.

If you need true immutability, ship audit events to an append-only sink (S3 with object-lock, an immutable log service) via webhook.

  • Review failed logins weekly. Brute-force probing shows up here even when rate limiting blocks individual attempts.
  • Filter the audit log by project when investigating a project-specific incident.
  • Use webhook subscriptions for time-sensitive events (token revocation, OAuth refresh failures).
  • Export CSV monthly as part of your backup routine — gives you an offline trail.

Next: Webhooks in the Administration section.


© Akyros Labs LLC. All rights reserved.