Audit Logging
Every significant action is logged with who, what, when, and why. Designed for SOC 2 compliance.
What’s Logged
Log Structure
Using the Audit Functions
Basic Audit Log
With Request Context (IP/User Agent)
Convenience Functions
Querying Logs
Via API
Direct SQL
Access Review Report
For SOC 2 access reviews, export a report of all users with system access:- All users with access
- Their roles and permissions
- Account status (Active/Pending)
- Last activity timestamp
Retention Policy
Audit logs are retained for 7 years (2555 days) by default for SOC 2 compliance.Configuration
The retention period is stored insystem_settings.audit_retention_days.
Automated Cleanup
A daily cron job cleans up expired logs:vercel.json:
IP Anonymization
IP addresses are anonymized for privacy while preserving geographic analysis capability:- IPv4: Last octet zeroed (e.g.,
192.168.1.100→192.168.1.0) - IPv6: Last 80 bits zeroed
Immutability
Audit logs are append-only. The database enforces this via RLS:UI Dashboard
Access the audit log dashboard at Settings → Audit Logs:- View all actions with filtering by type, entity, date
- Search by user email or entity ID
- Export access review reports
- View detailed change diffs
Database Schema
Full table reference
Security
Security best practices