Audit Logging

January 4, 2026 ยท View on GitHub

SimpleTuner's audit logging system provides a tamper-evident record of security-relevant events. All administrative actions, authentication events, and job operations are logged with cryptographic chain verification.

Overview

The audit log captures:

  • Authentication events: Login attempts (success/failure), logouts, session expirations
  • User management: User creation, updates, deletions, permission changes
  • API key operations: Key creation, revocation, usage
  • Credential management: Provider credential changes
  • Job operations: Submissions, cancellations, approvals

Accessing Audit Logs

Web UI

Navigate to the Audit tab in the admin panel to browse audit entries with filtering options.

CLI

# List recent audit entries
simpletuner auth audit list

# Filter by event type
simpletuner auth audit list --event-type auth.login.failed

# Filter by user
simpletuner auth audit user 123

# View security events only
simpletuner auth audit security

# Get statistics
simpletuner auth audit stats

# Verify chain integrity
simpletuner auth audit verify

API Endpoints

All endpoints require the admin.audit permission.

MethodEndpointDescription
GET/api/auditList audit entries with filters
GET/api/audit/statsGet audit statistics
GET/api/audit/typesList available event types
GET/api/audit/verifyVerify chain integrity
GET/api/audit/user/{user_id}Get entries for a user
GET/api/audit/securityGet security-related events

Event Types

Authentication Events

EventDescription
auth.login.successSuccessful login
auth.login.failedFailed login attempt
auth.logoutUser logged out
auth.session.expiredSession expired
auth.api_key.usedAPI key was used

User Management Events

EventDescription
user.createdNew user created
user.updatedUser details updated
user.deletedUser deleted
user.password.changedUser changed their password
user.level.changedUser level/role changed
user.permission.changedUser permission changed

API Key Events

EventDescription
api_key.createdNew API key created
api_key.revokedAPI key revoked

Credential Events

EventDescription
credential.createdProvider credential added
credential.deletedProvider credential removed
credential.usedCredential was used

Job Events

EventDescription
job.submittedJob submitted to queue
job.cancelledJob was cancelled
job.approvedJob approval granted
job.rejectedJob approval denied

Query Parameters

When listing audit entries, you can filter by:

ParameterTypeDescription
event_typestringFilter by event type
actor_idintFilter by user who performed action
target_typestringFilter by target resource type
target_idstringFilter by target resource ID
sinceISO dateStart timestamp
untilISO dateEnd timestamp
limitintMax entries (1-500, default 50)
offsetintPagination offset

Chain Integrity

Each audit entry includes:

  • A cryptographic hash of its content
  • A reference to the previous entry's hash
  • Timestamp from a monotonic clock

This creates a hash chain that makes tampering detectable. Use the verify endpoint or CLI command to check integrity:

# Verify entire chain
simpletuner auth audit verify

# Verify specific range
simpletuner auth audit verify --start-id 100 --end-id 200

The verification checks:

  1. Each entry's hash matches its content
  2. Each entry correctly references the previous entry's hash
  3. No gaps in the sequence

Retention

Audit logs are stored in the SimpleTuner database. Configure retention in your deployment:

# Environment variable for retention period (days)
SIMPLETUNER_AUDIT_RETENTION_DAYS=365

Older entries can be archived or purged according to your compliance requirements.

Security Considerations

  • Audit logs are append-only; entries cannot be modified or deleted through the API
  • The admin.audit permission is required to view logs
  • Failed login attempts are logged with IP addresses for security monitoring
  • Consider forwarding audit logs to a SIEM for production deployments