auditlog

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package auditlog provides a comprehensive audit trail of all API access. It records every HTTP request, creates queryable audit events, and has a background retention cleanup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() plugin.Plugin

New creates a new Plugin instance.

Types

type Config

type Config struct {
	RetentionDays int `json:"retention_days"` // default 90
}

Config controls audit-log behaviour.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements audit trail recording and querying.

func (*Plugin) Info

func (p *Plugin) Info() plugin.PluginInfo

Info returns plugin metadata for discovery and documentation.

func (*Plugin) Init

func (p *Plugin) Init(ctx context.Context, env *plugin.Environment) error

Init initialises the plugin with the given environment.

func (*Plugin) Middleware

func (p *Plugin) Middleware(next http.Handler) http.Handler

Middleware wraps every request and records an audit event.

func (*Plugin) Migrations

func (p *Plugin) Migrations() []plugin.Migration

Migrations returns the database schema for audit events.

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(mux *http.ServeMux) error

RegisterRoutes registers HTTP routes for querying audit events.

func (*Plugin) Run

func (p *Plugin) Run(ctx context.Context) error

Run starts the background goroutine. It periodically drains the audit event buffer and runs retention cleanup. Returns when ctx is cancelled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL