Audit Logging Guide
Overview
Audit logging provides an immutable record of all permission changes in your organization, enabling compliance tracking, debugging, and accountability. Logs are append-only, never modified, and automatically cleaned up based on retention policy.How It Works
Log Lifecycle
- Event Occurs — A role, team, or membership change happens
- Log Created — The change is recorded with actor, IP, timestamp, and details
- Stored Permanently — Log becomes immutable (read-only forever)
- Queryable — Admins can search by actor, resource, action, or date
- Cleaned Up — Logs older than retention period are deleted by cleanup job
Audit Actions (MVP)
Querying Audit Logs
Basic Query
Get all audit logs for your organization:Filter by Actor
Find all changes made by a specific user:Filter by Resource
Track all changes to a specific role:role— Custom role changesteam— Team CRUD operationsmember— Member changes (added, removed, role assignments)
Filter by Date Range
Get logs from the last 30 days:Combined Filters
Find all role-related changes by an admin in the last week:Log Format
Example Audit Log Entry
Field Definitions
Retention Policy
Default Retention
Organizations retain audit logs for a default period (e.g., 90 days). After this period, logs are automatically deleted. The response from the audit API includes the retention period:Cleanup Process
A scheduled job (cron, Lambda, etc.) calls the cleanup endpoint periodically:Dry Run
Test cleanup without deleting:Common Use Cases
Compliance Audit
“Show me all role changes made in Q1 2026”:Security Investigation
“Did someone add themselves as an admin without authorization?”:Debugging Permission Issues
“Why does Alice not have content:publish permission?”:Admin Activity Review
“What did the new admin do in their first week?”:Best Practices
Regular Audits
Schedule weekly or monthly reviews of audit logs to catch suspicious activity early.Retention Strategy
- Short retention (30 days): For compliance-sensitive data, delete quickly
- Standard retention (90 days): Default for most organizations
- Long retention (1 year): For highly regulated industries
Immutability Guarantee
Audit logs are guaranteed immutable. They cannot be:- Modified or edited
- Deleted except by retention policy
- Hidden from queries
IP Address Logging
Logs capture the requester’s IP address for security investigations:API Pagination
Audit logs support pagination to handle large result sets efficiently:total to calculate how many pages exist: Math.ceil(total / pageSize).