audit

package
v0.0.0-...-a78c924 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ptr

func Ptr(s string) *string

Ptr is a convenience helper to create a *string for the details field.

func Record

func Record(db *gorm.DB, c echo.Context, action, resourceType, resourceID string, details *string)

Record logs an audit event for an authenticated handler. It reads the actor from the Echo context (set by AuthMiddleware). Errors are logged but never returned — audit must not fail user requests.

func RecordWithActor

func RecordWithActor(db *gorm.DB, c echo.Context, actorID, actorEmail, action, resourceType, resourceID string, details *string)

RecordWithActor logs an audit event with an explicit actor. Use this for pre-auth handlers (login, register) where context values are not yet populated.

Types

type RetentionRunner

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

RetentionRunner periodically deletes old audit log entries.

func NewRetentionRunner

func NewRetentionRunner(db *gorm.DB, maxDays int) *RetentionRunner

NewRetentionRunner creates and starts a retention runner that deletes audit logs older than maxDays. Ticks every hour.

func (*RetentionRunner) Stop

func (r *RetentionRunner) Stop()

Stop stops the retention runner and waits for it to finish.

Jump to

Keyboard shortcuts

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