audit

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package audit is the change log every real product needs — a record of the operator actions that mutate config or data (account changes, key create/revoke, retention, data clears). Append-only JSONL, bounded in memory, compacted on boot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Time   time.Time `json:"time"`
	Action string    `json:"action"`
	Detail string    `json:"detail"`
}

Entry is one logged action.

type Log

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

Log is a concurrency-safe, persisted audit log.

func Open

func Open(path string) (*Log, error)

Open loads the log (keeping the most recent maxEntries) and compacts the file on boot so it can't grow without bound. Empty path = in-memory only.

func (*Log) Close

func (l *Log) Close() error

func (*Log) Recent

func (l *Log) Recent(limit int) []Entry

Recent returns the newest entries first (limit <= 0 means all held).

func (*Log) Record

func (l *Log) Record(action, detail string)

Record logs an action. Best-effort and never fatal — auditing must not break the operation it's recording.

Jump to

Keyboard shortcuts

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