Auditing
Guide to audit logging and compliance in Lager Guru.
Overview
Audit logging tracks all user actions and system events for compliance and security.
Audit Events
User Actions
- Login/logout
- User creation/modification
- Permission changes
- Data access
System Events
- Configuration changes
- Tenant operations
- Security events
- Error events
Audit Log Structure
json
{
"timestamp": "2025-12-02T10:00:00Z",
"user_id": "uuid",
"tenant_id": "uuid",
"action": "user.created",
"resource": "users",
"resource_id": "uuid",
"details": {},
"ip_address": "192.168.1.1"
}Accessing Audit Logs
Via Admin Interface
- Navigate to Admin → Audit Logs
- Filter by:
- Date range
- User
- Action type
- Resource
- Export logs if needed
Via API
typescript
const { data } = await supabase
.from('audit_logs')
.select('*')
.eq('tenant_id', tenantId)
.order('timestamp', { ascending: false })Compliance
GDPR Compliance
- User data access logs
- Data deletion logs
- Consent tracking
SOC 2 Compliance
- Access control logs
- Configuration change logs
- Security event logs
Retention
Retention Policy
- Active logs: 90 days
- Archived logs: 1 year
- Compliance logs: 7 years (if required)
Best Practices
- Enable audit logging for all critical operations
- Regular log review
- Automated alerting for suspicious activity
- Secure log storage
- Regular compliance audits