audit

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package audit defines the append-only audit contract. The Postgres store is the system of record; sinks fan events out (OTLP, syslog, SIEM). Audit is free forever — never gate it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogWriteFailure added in v0.3.1

func LogWriteFailure(ctx context.Context, ev types.AuditEvent, err error)

LogWriteFailure reports a dropped audit write on the structured logger. A failed Record must never block the operation that produced the event (the Recorder owns durability/retry), but it must also never be swallowed in silence: the audit log is the system of record, so a lost event is an ERROR-level fact an operator can alert on.

Only the event's routing fields are logged. ev.Data is deliberately NOT logged: it carries per-action payloads (grant scopes, jti, approval ids) and is the one field on an AuditEvent that can hold sensitive material. Callers must not add it, nor any secret-bearing attr, here.

Types

type Recorder

type Recorder interface {
	Record(ctx context.Context, ev types.AuditEvent) error
}

Recorder persists events to the system of record (append-only).

type Sink

type Sink interface {
	Name() string // "otlp" | "syslog" | ...
	Emit(ctx context.Context, ev types.AuditEvent) error
}

Sink streams recorded events to an external destination. Sinks must not block recording: failures are logged and retried, never dropped silently without a counter.

Directories

Path Synopsis
Package sinks provides production audit.Sink implementations (syslog, webhook, file) plus a Fanout multiplexer and config wiring.
Package sinks provides production audit.Sink implementations (syslog, webhook, file) plus a Fanout multiplexer and config wiring.

Jump to

Keyboard shortcuts

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