Skip to main content
Every request that passes through gateway-proxy, evaluate-action, mcp-gate, or a webhook handler produces an audit_logs row. Rows are append-only — Sentrail never modifies or deletes them outside of scheduled purges (configurable per plan).

What gets logged

ColumnTypeDescription
iduuidUnique log entry ID
workspace_iduuidWorkspace that owns this log
correlation_iduuidLinks the audit log to its approval request and deferred action
agent_iduuidFK to agent_identities (nullable)
agent_nametextString identifier from X-Agent-Id header
tooltextgithub, linear, mcp, system, etc.
actiontextClassified action string, e.g. pull_request.create
decisiontextallow, block, require_approval, or error
risk_levelenumlow, medium, high, critical
matched_policy_iduuidFK to the policy that made the decision (nullable)
resource_typetextissue, pull_request, file, etc.
resource_idtexte.g. owner/repo#42
requested_bytextAgent ID or email of the requester
payload_previewjsonbTruncated payload for display (not the full body)
sourcetextgateway, webhook, manual, mcp, proxy
created_attimestamptzWhen the action was evaluated

Correlation IDs

The correlation_id is a UUID generated at evaluation time and threaded through the entire request lifecycle:
  1. Created in evaluate-action-core.ts when the audit log is written
  2. Returned to the agent in X-Sentrail-CorrelationId response header
  3. Stored in approval_requests.correlation_id
  4. Used in the /gateway-proxy/status/:correlationId poll endpoint
  5. Written to subsequent audit log entries (e.g. approval decision)
You can look up any approval request, deferred action, or audit entry by correlation ID.

Decision values

ValueMeaning
allowPolicy matched and action was forwarded, or default allow
blockPolicy matched and action was rejected
require_approvalPolicy matched and action was deferred for human review
errorAn unexpected error occurred during evaluation

Source values

ValueOrigin
gatewayCame through gateway-proxy
mcpCame through mcp-gate
webhookCame through webhook-github or webhook-linear
manualCreated by approval-decision or kill-switch
proxyDirect proxy call

Retention and purging

Audit logs are purged on a schedule based on your plan. The purge-audit-logs cron function runs on the schedule_audit_log_purges schedule. Purge policies are configurable — contact support to adjust retention.
Audit logs are protected by Row Level Security. Members can view logs for their own workspace only. The service role (used by edge functions) can write logs; no user-level role can delete or update them.

Querying audit logs

You can query audit logs through the Supabase client from authenticated frontend code:
const { data } = await supabase
  .from("audit_logs")
  .select("*")
  .eq("workspace_id", workspaceId)
  .order("created_at", { ascending: false })
  .limit(50);
Filter by decision:
.eq("decision", "block")
Filter by correlation ID:
.eq("correlation_id", "550e8400-e29b-41d4-a716-446655440000")