mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-07-26 11:49:16 +00:00
6daa7a135d
* fix(audit): harden audit log with summary fixes, design compliance, and test coverage Replace stale /compose/* route summaries with current /stacks/* patterns, add ~30 missing route summaries for container ops, labels, fleet updates, SSO, templates, and auto-update. Fix X-Forwarded-For extracting full proxy chain instead of first client IP. Pre-sort pattern table at module load for O(1) lookup instead of sorting per request. Add Calendar and DatePicker UI components (react-day-picker v9 + date-fns) replacing browser-native date inputs. Align AuditLogView with design system: Combobox instead of Select, design token colors, strokeWidth 1.5, card bevel, tabular-nums on all numeric cells. Add diagnostic logging gated behind developer mode for audit middleware, query, and export endpoints. Extract getAuditSummary to testable utility. Add 32 tests covering summary resolution, DB round-trips, API permissions, export formats, and middleware integration. * fix(audit): use correct Chevron prop types for react-day-picker compatibility
126 lines
5.3 KiB
Plaintext
126 lines
5.3 KiB
Plaintext
---
|
|
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`), shown as a color-coded badge |
|
|
| **Action** | Human-readable summary (e.g., "Deployed stack: nginx-proxy") |
|
|
| **Status** | HTTP response status code, color-coded by result (green for success, yellow for client errors, red for server errors) |
|
|
| **Node** | Which node the action targeted, or `-` for local-only actions |
|
|
|
|
Expanding a row reveals additional detail:
|
|
|
|
| Field | Description |
|
|
|-------|-------------|
|
|
| **Request Path** | Full API path of the request |
|
|
| **IP Address** | Client IP address |
|
|
| **Node ID** | Numeric node ID, or "Local" for local actions |
|
|
| **Entry ID** | Unique identifier for the audit entry |
|
|
|
|
### Example actions tracked
|
|
|
|
- Stack lifecycle: deploy, stop, start, restart, update, rollback, delete
|
|
- Stack creation, file edits, and env file changes
|
|
- Container operations: start, stop, restart
|
|
- Node management: add, update, delete
|
|
- User management: create, delete, role assignment and removal
|
|
- Password changes and node token generation
|
|
- Settings changes
|
|
- System prune operations (general, orphans, system)
|
|
- Image, volume, and network deletion
|
|
- Network creation
|
|
- License activation/deactivation
|
|
- Webhook and notification agent configuration
|
|
- Notification route management and testing
|
|
- Fleet backup creation, restoration, and deletion
|
|
- Fleet node updates (individual and fleet-wide)
|
|
- Scheduled task management
|
|
- Registry credential management
|
|
- SSO configuration changes and connection tests
|
|
- API token creation and revocation
|
|
- Label management and bulk actions
|
|
- Template deployments
|
|
- Auto-update execution
|
|
- Console token generation
|
|
|
|
## 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 the action table with search filters, color-coded method badges, and export controls" />
|
|
</Frame>
|
|
|
|
Click any row to expand it and see the full request details inline.
|
|
|
|
<Frame>
|
|
<img src="/images/audit-log/audit-log-expanded.png" alt="Audit Log with an expanded row showing request path, IP address, node ID, and entry ID" />
|
|
</Frame>
|
|
|
|
The header displays the total number of matching entries and provides **Refresh** and **Export** controls.
|
|
|
|
Results are paginated at 50 entries per page. Navigation controls appear at the bottom of the table when there are multiple pages.
|
|
|
|
## Filtering and 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) using the dropdown
|
|
- **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 (1-365 days)
|
|
3. Click **Save Developer Settings**
|
|
|
|
<Frame>
|
|
<img src="/images/audit-log/data-retention.png" alt="Data Retention settings showing Audit Log Retention set to 90 days" />
|
|
</Frame>
|
|
|
|
Cleanup runs automatically as part of Sencho's periodic maintenance cycle.
|
|
|
|
## Security at rest
|
|
|
|
Sensitive database values (such as remote node API tokens) are encrypted at rest. The encryption key is stored separately from the database, ensuring that database file exposure alone does not compromise secrets.
|