Audit Logs
Read, export, and review the AgentShield audit trail. Events, hash-chain links, head exports, and evidence in daily operations.
AgentShield's audit trail is a set of append-only records in PostgreSQL: security events that describe what happened and audit links that chain them per organization. This page covers day-to-day use; the integrity model is in Auditability.
Who can read what
| Record | Route | Roles |
|---|---|---|
| Events | GET /api/v1/events, /api/v1/events/stream | owner, admin, auditor, operator |
| Audit links | GET /api/v1/audit | owner, admin, auditor |
| Head exports | GET/POST /api/v1/audit/exports | owner, admin, auditor |
| Incidents | GET /api/v1/incidents | owner, admin, auditor |
| Alerts | GET /api/v1/alerts | owner, admin, auditor |
| Evidence | GET /api/v1/evidence, /api/v1/evidence/{id} | owner, admin, auditor |
Give reviewers the auditor role: read access to everything audit-related, and no ability to change agents, policies, or approvals.
Reading events
curl -s "http://127.0.0.1:8080/api/v1/events?limit=100" -H "Authorization: Bearer $TOKEN"Events are newest first. Follow next_cursor to page back. Each event has event_type, occurred_at, agent_id, execution_id, and a redacted payload_redacted.
Useful questions and the events that answer them:
| Question | Look for |
|---|---|
| What did agent X try to do? | authorization.decided with its agent_id; check outcome and reason |
| Did the call actually run? | tool.executed or tool.failed with the same execution_id |
| Who released a held action? | approval.decided |
| When was this agent disabled? | agent.suspended, agent.revoked |
| Was a key rotated? | credential.rotated |
| Who changed membership? | member.* |
| Who looked at evidence? | evidence.viewed |
Exporting the head
Export the audit head on a schedule (daily is a reasonable start) and after significant events:
curl -s -X POST http://127.0.0.1:8080/api/v1/audit/exports \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"destination\":\"daily/$(date -u +%F)\"}"Store the returned sequence and head_hash in a system the database owner cannot modify. The console's Audit section can also trigger an export.
Retention
Security events, audit links, decisions, and policy versions are append-only and are never deleted by AgentShield. Plan database capacity accordingly. The NATS stream keeps seven days; object storage retention is yours to set.
Reviewing approvals
For any approval.decided event, the corresponding approval row records the deciding user, time, payload hash, and status. Combined with the original authorization.decided event (same execution_id) and the tool.executed event, it shows who approved what, when, and that the executed request matched.
Was this page helpful?