Audit Logs
View, filter, export, and archive system operation audit logs
Audit logs record resource operations across the system: the actor, action, resource, before/after change snapshots, and source IP. Sensitive fields are redacted at write and display time, so raw secrets never appear in logs. Viewing audit logs requires audit:read; exporting requires audit:export.
Audit Log Events
Audit logs cover the following event types. Each event records the actor, timestamp, resource, operation type, status, and change details.
Authentication Events
User login, logout, and registration actions:
| Event | Description | Recorded Content |
|---|---|---|
login_success | Successful login | User, time, IP, User Agent, auth method, 2FA used |
login_failed | Failed login | User, time, IP, failure reason, attempt count |
logout | Logout | User, time, IP, session duration |
register | Registration | User, time, IP, registration method, email verified |
User Management Events
Administrator actions on user accounts:
| Event | Description | Recorded Content |
|---|---|---|
create_user | Create user | Actor, time, new user email, full name, role, status |
update_user | Update user | Actor, time, changed fields before/after (e.g., role, status) |
delete_user | Delete user | Actor, time, deleted user identifier |
Team Management Events
Team creation and member changes:
| Event | Description | Recorded Content |
|---|---|---|
create_team | Create team | Actor, time, team name, description, owner |
add_team_member | Add team member | Actor, time, team, member ID, member email, role |
remove_team_member | Remove team member | Actor, time, team, member ID, removal reason |
Agent Events
Agent creation, update, publish, and deletion:
| Event | Description | Recorded Content |
|---|---|---|
create_agent | Create Agent | Actor, time, Agent name, team, model |
update_agent | Update Agent | Actor, time, changed fields before/after (e.g., max_iterations, system_prompt) |
publish_agent | Publish Agent | Actor, time, visibility, marketplace listing |
delete_agent | Delete Agent | Actor, time, Agent identifier |
API Key Events
API Key creation and state changes:
| Event | Description | Recorded Content |
|---|---|---|
create_api_key | Create API Key | Actor, time, Key name, scopes, agent/workflow count, expiration |
activate_api_key | Activate API Key | Actor, time, Key identifier |
deactivate_api_key | Deactivate API Key | Actor, time, Key identifier, deactivation reason |
System Settings Events
Site configuration changes:
| Event | Description | Recorded Content |
|---|---|---|
update_site_setting | Update single setting | Actor, time, setting key, before/after values |
bulk_update_site_settings | Bulk update settings | Actor, time, count of updated settings, setting keys list |
reset_site_settings | Reset settings | Actor, time, reset category, count of reset settings |
Security Events
Account security-related operations:
| Event | Description | Recorded Content |
|---|---|---|
change_password | Change password | User, time, IP |
reset_password | Reset password | User, time, reset method, initiated by |
activate_user | Activate account | Actor, time, target user |
deactivate_user | Deactivate account | Actor, time, target user, deactivation reason |
Viewing and Filtering
Open Admin > Audit Logs. Each entry shows: timestamp, user, action, resource type, resource name, operation (create/read/update/delete), status, IP address, and details.
Search and Filtering
The list endpoint GET /api/v1/admin/audit-logs supports the following query parameters:
| Parameter | Description |
|---|---|
user_id | Filter by user UUID |
team_id | Filter by team UUID |
action | Filter by exact action values; supports repeated values for action__in match (wildcards not supported) |
resource_type | Filter by resource type (user, team, agent, workflow, etc.) |
resource_id | Filter by resource UUID |
status | Filter by status (success, failed, etc.) |
start_date / end_date | Filter by time period |
search | Case-insensitive substring (icontains) search over resource name, resource ID, and IP address |
There is no dedicated IP address filter parameter, but the search field supports substring matching on IPs (e.g., 192.168.1.). search does not interpret * or other glob patterns.
Roadmap: Cannot filter by changed field, before value, or after value. Field-level changes are visible only in log details and exports.
Roadmap: No saved-search feature yet. Re-run the filters you need manually.
Viewing Log Details
Click a log entry to view full details, including:
- Basic Information: ID, timestamp, user, user ID, action, status
- Resource Information: Resource type, resource ID, resource name, operation type
- Request Information: IP address, User Agent, auth method
- Changes:
before/afterfield-level change snapshots (sensitive values redacted) - Metadata: Team ID/name, model, duration, etc.
Roadmap: No "Related Logs" view. To find related entries, filter by the same user_id, resource_id, or time range.
Sensitive Data Redaction
Field-level before / after change data is processed by AuditLogService.sanitize_changes before storage:
- Sensitive fields are masked: Keys containing
password,hashed_password,api_key,secret_key,access_token,refresh_token,private_key,secret, ortokenare masked. String values longer than 8 characters show only the first 8 characters followed by***; other values are replaced with***. - Email addresses are partially masked: with a local part longer than 2 characters the first and last characters are kept (
a***e@example.com); with 2 or fewer, only the first is kept (a***@example.com). - Nested dictionaries are processed recursively.
- Values are truncated to a maximum field length (500 characters); oversized structures are replaced with a preview string.
Because redaction happens at write time, raw secrets never appear in audit logs.
Exporting Audit Logs
Export Formats
Supports CSV and JSON. The export endpoint GET /api/v1/admin/audit-logs/export?format=csv|json accepts every list filter except resource_id (user_id, team_id, action, resource_type, status, start_date, end_date, search) and returns up to 10,000 logs, newest first.
Export search differs from list search
The list endpoint's search matches resource name, resource ID, and IP address; the export endpoint's search matches resource name and IP address only (no resource ID), and there is no resource_id parameter at all. Searching by resource ID and then exporting therefore yields more rows than the list view — for troubleshooting, export using resource name or IP as the criterion.
CSV columns: ID, Time, User, Action, Resource Type, Resource Name, Operation, Status, IP Address, Error Message
JSON: Exports full serialized entries (including changes).
curl -X GET "https://your-domain.com/api/v1/admin/audit-logs/export?format=csv" \
-H "Authorization: Bearer $ADMIN_TOKEN"Roadmap: No scheduled exports (daily/weekly/monthly) or delivery to email/S3. Exports are manual only.
Retention and Archival
Retention Policy
Retention is controlled by the audit_log_retention_days site setting, default 365 days with a range of 30-3650.
Configuration: Navigate to Admin > Site Settings > Storage, set Audit log retention (days) and Archive file storage path (default /var/log/clouisle/audit_archives).
Manual Archive
- Navigate to Admin > Site Settings > Storage.
- In the Audit Logs section, click Archive and confirm.
- The task runs asynchronously (requires
audit:export); the UI polls task status every 2 seconds and times out after 5 minutes.
Note: The manual archive control lives on the Storage settings page, not on the audit log page — the audit log page only views, filters, and exports.
Endpoints used:
| Method | Path | Description |
|---|---|---|
POST | /api/v1/admin/site-settings/archive-audit-logs | Trigger the archive; returns { "task_id", "status": "pending" } |
GET | /api/v1/admin/site-settings/archive-audit-logs/{task_id} | Poll status: PENDING / STARTED / SUCCESS (with result.archived_count) / FAILURE (with error) |
POST | /api/v1/admin/audit-logs/archive | Equivalent trigger under the audit-log router: submits the same tasks.archive_old_audit_logs but returns only task_id — there is no companion status endpoint |
All three require audit:export; both success and failure of the trigger are themselves written to the audit log (trigger_audit_log_archive).
How Archiving Works:
- The archive task
tasks.archive_old_audit_logsselects logs older than the retention cutoff (now - audit_log_retention_days) - Logs are exported to local JSON files grouped by month, e.g.
/var/log/clouisle/audit_archives/audit_logs_202602.json(existing monthly files are appended to) - Once archived, those rows are deleted from the database
Archiving deletes the archived rows from the database, leaving only the local JSON files. The archive path must live on a persistent volume, otherwise a container rebuild destroys the only copy — and confirm audit_log_retention_days against your compliance requirement before triggering.
Roadmap: There is no scheduled automatic archive — archiving is always manual — and no S3/Azure/Blob archive destinations. Archive output is written only to the local path configured in audit_log_archive_path.
Roadmap: No restore workflow for archived logs. Monthly JSON archive files under the archive path remain available for manual inspection.
Archive Status Query
GET /api/v1/admin/audit-logs/stats/retention returns: configured retention_days, cutoff_date, logs_to_archive, oldest_log_date, and next_archive_date.
next_archive_date is a value the endpoint computes as "tomorrow at 03:00" — no Celery Beat schedule backs it. Archiving is always manual; do not read it as a promise that the system will archive automatically at that time (app/core/celery.py's beat_schedule has no archive task).
Statistics Endpoints
GET /api/v1/admin/audit-logs/stats returns aggregate statistics: total logs, today's logs, failed logs, active users (last 7 days), top 5 actions, top 5 users.
Roadmap: No audit report generator (user activity, admin actions, security events, resource changes, failed operations, or custom reports). The statistics endpoints above provide the currently available aggregates.
Roadmap: No real-time monitoring dashboard for audit logs. Site settings such as audit_alert_enabled, audit_alert_webhook, and failed-login thresholds exist as dormant configuration but are not consumed by any monitoring or notification code (see the "Audit Alerts" subsection of Site Settings).
API Endpoint Reference
| Method | Path | Description | Permission |
|---|---|---|---|
GET | /api/v1/admin/audit-logs | Query audit log list (with filtering) | audit:read |
GET | /api/v1/admin/audit-logs/{id} | Get single audit log details | audit:read |
GET | /api/v1/admin/audit-logs/export?format=csv|json | Export audit logs (up to 10,000) | audit:export |
GET | /api/v1/admin/audit-logs/stats | Get audit statistics aggregates | audit:read |
GET | /api/v1/admin/audit-logs/stats/retention | Get retention and archival status | audit:read |
POST | /api/v1/admin/audit-logs/archive | Trigger manual archive task (returns task_id only) | audit:export |
POST | /api/v1/admin/site-settings/archive-audit-logs | Trigger manual archive task (used by the Storage settings page; returns task_id + status) | audit:export |
GET | /api/v1/admin/site-settings/archive-audit-logs/{task_id} | Poll archive task status and result | audit:export |
Best Practices
Audit Logging
- Enable audit logging for all actions
- Log both successes and failures
- Include sufficient context
- Protect log integrity
- Review logs regularly
- Archive logs appropriately
- Monitor for anomalies
- Set up alerts for critical events
Log Analysis
- Review logs regularly
- Look for patterns and trends
- Investigate anomalies
- Generate regular reports
- Share findings with team
- Document incidents and remediation
- Use logs for compliance
Security
- Restrict log access
- Encrypt archived logs
- Use secure storage
- Monitor log access behavior
- Audit the auditors
- Maintain log integrity
- Comply with regulations
See also:
- Roles & Permissions —
audit:read/audit:exportpermissions - Notifications — security event notification channels
How is this guide?