audit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package audit provides audit logging capabilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditEntry

type AuditEntry struct {
	ID        string                 `json:"id"`
	Timestamp time.Time              `json:"timestamp"`
	User      string                 `json:"user"`
	Action    string                 `json:"action"`
	Resource  string                 `json:"resource"`
	Details   map[string]interface{} `json:"details,omitempty"`
	IPAddress string                 `json:"ip_address,omitempty"`
	UserAgent string                 `json:"user_agent,omitempty"`
	Status    string                 `json:"status"`
}

AuditEntry represents an audit log entry

type AuditFilter

type AuditFilter struct {
	User     string
	Action   string
	Resource string
	FromDate time.Time
	ToDate   time.Time
	Status   string
}

AuditFilter filters audit entries

func (AuditFilter) Matches

func (f AuditFilter) Matches(entry AuditEntry) bool

Matches checks if an entry matches the filter

type AuditLogger

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

AuditLogger provides audit logging

func NewAuditLogger

func NewAuditLogger(outputPath string, maxSize int) (*AuditLogger, error)

NewAuditLogger creates a new audit logger

func (*AuditLogger) Close

func (al *AuditLogger) Close() error

Close closes the audit logger

func (*AuditLogger) Export

func (al *AuditLogger) Export(format string) ([]byte, error)

Export exports audit entries

func (*AuditLogger) GetEntries

func (al *AuditLogger) GetEntries(filter AuditFilter) []AuditEntry

GetEntries returns audit entries

func (*AuditLogger) Log

func (al *AuditLogger) Log(entry AuditEntry) error

Log logs an audit entry

Jump to

Keyboard shortcuts

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