audit

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package audit keeps the audit log bounded: a daily prune deletes entries older than the retention, after handing them to the configured export so they still exist somewhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Prune

func Prune(ctx context.Context, d *db.DB, retention time.Duration, export Export, exportName string) (int, error)

Prune deletes entries older than retention (export first) and records the prune in the audit log itself. It returns how many entries it deleted.

func Redact

func Redact(target string) string

Redact hides userinfo in an export URL before it is logged or audited

func RunPruner

func RunPruner(ctx context.Context, d *db.DB, retention time.Duration, export Export, exportName string)

RunPruner prunes a minute after start and then once a day until ctx ends. retention 0 disables it.

Types

type Export

type Export func(ctx context.Context, entries []*db.AuditEntry) error

Export delivers entries to a destination; an error keeps them in the database

func NewExport

func NewExport(target string, headers map[string]string) (Export, error)

NewExport builds the export named by target (see config.AuditConfig.Export) and checks the destination is reachable now, so a typo fails at startup rather than at the first prune. Empty target: nil, no export.

Jump to

Keyboard shortcuts

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