Files
sencho/docs/features/audit-log.mdx
T
Anso d586ce393a feat(audit-log): add configurable retention, export, Auditor role, and enhanced filtering (#258)
- Configurable retention: audit_retention_days setting (1-365 days, default 90)
  replaces hardcoded 90-day retention, exposed in Settings > Data Retention
- Export: one-click CSV/JSON export of filtered audit data via new
  GET /api/audit-log/export endpoint (capped at 10,000 entries)
- Auditor role: read-only role with system:audit permission for viewing
  and exporting audit logs without admin privileges (Admiral tier)
- Enhanced filtering: full-text search across summaries/paths/usernames,
  date range picker, and expandable row details showing request path,
  IP address, node ID, and entry ID
2026-03-29 20:18:51 -04:00

95 lines
4.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Audit Log
description: Track all mutating actions across your Sencho instance with a searchable, exportable audit trail for team accountability.
---
<Note>
The Audit Log requires a Sencho **Admiral** license. Skipper and Community Edition do not include this feature.
</Note>
Sencho Admiral records every mutating action (deploy, stop, delete, settings changes, user management) with full attribution. The audit log answers the question every team eventually asks: **"Who changed what, and when?"**
## What gets logged
Every `POST`, `PUT`, `DELETE`, and `PATCH` request to the Sencho API is automatically recorded with:
| Field | Description |
|-------|-------------|
| **Timestamp** | When the action occurred |
| **User** | The authenticated username that performed the action |
| **Method** | HTTP method (`POST`, `PUT`, `DELETE`, `PATCH`) |
| **Action** | Human-readable summary (e.g., "Deployed stack: nginx-proxy") |
| **Status** | HTTP response status code |
| **Node** | Which node the action targeted |
| **Request Path** | Full API path (visible in expanded detail view) |
| **IP Address** | Client IP address (visible in expanded detail view) |
### Example actions tracked
- Stack lifecycle: deploy, stop, start, restart, pull, delete
- Stack creation and file edits
- Node management: add, update, delete
- User management: create, delete, role changes
- Settings changes
- System prune operations
- License activation/deactivation
- Webhook and notification agent configuration
- Fleet backup creation, restoration, and deletion
- Scheduled task management
- Registry credential management
## Viewing the audit log
Navigate to the **Audit** tab in the sidebar. This tab is visible to users with the **Admin** or **Auditor** role on an Admiral license.
<Frame>
<img src="/images/audit-log/audit-log-overview.png" alt="Audit Log view showing a timeline of actions with search, filters, and export" />
</Frame>
Click any row to expand it and see full request details including the API path, IP address, node ID, and entry ID.
## Filtering & search
The audit log provides several ways to find specific entries:
- **Full-text search** — Search across action summaries, API paths, and usernames
- **Method filter** — Filter by HTTP method (POST, PUT, DELETE, PATCH)
- **Date range** — Set a start and/or end date to narrow results to a specific time window
All filters work together and are applied server-side with pagination.
## Export
Export the currently filtered audit log dataset as **CSV** or **JSON** using the **Export** dropdown in the header. The export respects all active filters — so you can narrow down to a date range or specific user before exporting.
Exports are capped at 10,000 entries per download.
## Auditor role
The **Auditor** role provides read-only access to the audit log without granting any administrative privileges. Auditors can:
- View the full audit log
- Search and filter entries
- Export audit data as CSV or JSON
- View stacks and nodes (read-only)
Auditors **cannot** modify settings, manage users, deploy stacks, or perform any other administrative actions. This role is ideal for compliance officers, security reviewers, or team leads who need visibility into system activity without operational access.
To create an Auditor user, go to **Settings → Users** and select the **Auditor** role when creating a new user.
## Configurable data retention
Audit log entries are automatically cleaned up based on your configured retention period. The default is **90 days**.
To change the retention period:
1. Go to **Settings → Developer → Data Retention**
2. Set the **Audit Log Retention** value (1365 days)
3. Click **Save Developer Settings**
Cleanup runs automatically as part of Sencho's periodic maintenance cycle.
## Security at rest
As of this release, sensitive database values (such as remote node API tokens) are encrypted at rest using AES-256-GCM. The encryption key is stored as a separate file outside the SQLite database, ensuring that database file exposure alone does not compromise secrets.