audit

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Timestamp   time.Time `json:"ts"`
	Node        string    `json:"node"`
	Tool        string    `json:"tool"`
	Command     string    `json:"command"`
	Shell       string    `json:"shell,omitempty"`
	ExitCode    int       `json:"exit_code"`
	DurationMs  int64     `json:"duration_ms"`
	OutputBytes int       `json:"output_bytes"`
	Truncated   bool      `json:"truncated"`
}

Entry represents a single audit log entry.

type Log

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

Log is an append-only audit logger.

The in-process mutex serialises writers within one LabLinkServer process; the OS-level lock on a sidecar file serialises across processes so that rotation (rename of history.jsonl -> history.1.jsonl) and concurrent appends from a sibling LabLinkServer cannot interleave or lose lines.

func NewLog

func NewLog(dirPath string) *Log

NewLog creates a new audit logger writing to the given directory.

func (*Log) Append

func (l *Log) Append(e Entry) error

Append writes an entry to the audit log.

func (*Log) Query

func (l *Log) Query(node string, commandFilter string, lastN int) ([]Entry, error)

Query returns recent entries matching the filters.

Jump to

Keyboard shortcuts

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