audit

package
v0.19.1302 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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