Skip to content

Add audit log database persistence, configurable logging targets, and admin viewer #58

@leodip

Description

@leodip

Description

Currently, audit events are only logged to the console via slog. We need to add the ability to persist audit logs to the database and give admins control over where audit events are sent.

Requirements

Database persistence

  • Add an audit_logs table (all supported DBs: SQLite, MySQL, PostgreSQL, MSSQL) to store event name, JSON details, and timestamp.
  • Write audit events to this table when database logging is enabled.
  • Add a background worker to delete audit logs older than the configured retention period.

Configurable logging targets

  • Add two independent settings toggles: log to console and persist to database (both can be enabled simultaneously).
  • Add a configurable retention period in days (0 = infinite retention).
  • Add admin API endpoints to get and update these settings.

Admin console UI

  • Add an Audit log settings page to configure the logging targets (console, database) and retention period.
  • Add a separate Audit log viewer page to browse stored audit logs with event type filtering, paginated table, and JSON detail display.
  • Add both pages as separate entries in the admin navigation menu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions