Help us shape the future of Go! Take the 2026 Go Developer Survey

audit

package
v0.19.1277 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Attr        = "nuon.audit"
	AttrValue   = "true"
	EventAttr   = "nuon.audit.event"
	OutcomeAttr = "nuon.audit.outcome"
)

Attr tags records the gateway collector forwards to the customer's backend. Collector filters compare the log record attribute against the string "true", so the value must not be emitted as a bool.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

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

func New

func New(params Params) (*Emitter, error)

New builds the audit emitter. Its logger is deliberately standalone rather than teed into the system logger: audit records must not reach stderr, so ctl-api's normal log output stays byte-for-byte unchanged and the Datadog monitors reading it are unaffected.

func NewEmitter

func NewEmitter(l *zap.Logger) *Emitter

func (*Emitter) Emit

func (e *Emitter) Emit(ctx context.Context, ev Event)

Emit writes one audit record. The actor and org come from the same context that BeforeCreate uses to populate created_by_id, so an audit record can never disagree with the row it describes about who caused it.

type Event

type Event struct {
	Type        EventType
	Message     string
	Outcome     Outcome
	InstallID   string
	AppID       string
	ComponentID string
	SubjectID   string
	SubjectType string
	Attrs       map[string]string
}

type EventType

type EventType string

EventType mirrors the type column of the install_audit_logs view so streamed audit records stay consistent with the ones customers download today.

const (
	EventInstallDeploy            EventType = "install_deploy"
	EventInstallActionWorkflowRun EventType = "install_action_workflow_run"
	EventInstallSandboxRun        EventType = "install_sandbox_run"
	EventPolicyReport             EventType = "policy_report"
)

type Outcome

type Outcome string
const (
	OutcomeStarted   Outcome = "started"
	OutcomeSucceeded Outcome = "succeeded"
	OutcomeFailed    Outcome = "failed"
)

type Params

type Params struct {
	fx.In

	Cfg *internal.Config
	LC  fx.Lifecycle
}

Jump to

Keyboard shortcuts

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