file

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Backend = "file"

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	// LogRotation settings (optional).
	LogRotation *LogRotationConf `yaml:"logRotation"`
	// Path to the log file to use as output. The special values stdout and stderr can be used to write to stdout or stderr respectively.
	Path string `yaml:"path" conf:"required,example=/path/to/file.log"`
	// AdditionalPaths to mirror the log output. Has performance implications. Use with caution.
	AdditionalPaths []string `yaml:"additionalPaths" conf:",example=[stdout]"`
}

Conf is optional configuration for file Audit.

func (*Conf) Key

func (c *Conf) Key() string

func (*Conf) SetDefaults

func (c *Conf) SetDefaults()

func (*Conf) Validate

func (c *Conf) Validate() error

type Log

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

func NewLog

func NewLog(conf *Conf, decisionFilter audit.DecisionLogEntryFilter) (*Log, error)

func (*Log) Backend added in v0.23.0

func (l *Log) Backend() string

func (*Log) Close

func (l *Log) Close() error

func (*Log) Enabled added in v0.23.0

func (l *Log) Enabled() bool

func (*Log) WriteAccessLogEntry

func (l *Log) WriteAccessLogEntry(_ context.Context, record audit.AccessLogEntryMaker) error

func (*Log) WriteDecisionLogEntry

func (l *Log) WriteDecisionLogEntry(_ context.Context, record audit.DecisionLogEntryMaker) error

type LogRotationConf added in v0.30.0

type LogRotationConf struct {
	// MaxFileSizeMB sets the maximum size of individual log files in megabytes.
	MaxFileSizeMB uint `yaml:"maxFileSizeMB" conf:",example=100"`
	// MaxFileAgeDays sets the maximum age in days of old log files before they are deleted.
	MaxFileAgeDays uint `yaml:"maxFileAgeDays" conf:",example=10"`
	// MaxFileCount sets the maximum number of files to retain.
	MaxFileCount uint `yaml:"maxFileCount" conf:",example=10"`
}

Jump to

Keyboard shortcuts

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