local

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Backend = "local"
)

Variables

View Source
var (
	AccessLogPrefix   = []byte("aacc")
	DecisionLogPrefix = []byte("adec")
)

Functions

func GenKey added in v0.35.0

func GenKey(prefix []byte, id audit.IDBytes) []byte

Types

type AdvancedConf

type AdvancedConf struct {
	BufferSize    uint          `yaml:"bufferSize" conf:",example=256"`
	MaxBatchSize  uint          `yaml:"maxBatchSize" conf:",example=32"`
	FlushInterval time.Duration `yaml:"flushInterval" conf:",example=1s"`
	GCInterval    time.Duration `yaml:"gcInterval" conf:",example=60s"`
}

type Conf

type Conf struct {
	// Path to store the data
	StoragePath string `yaml:"storagePath" conf:",example=/path/to/dir"`
	// How long to keep records for
	RetentionPeriod time.Duration `yaml:"retentionPeriod" conf:",example=168h"`
	Advanced        AdvancedConf  `yaml:"advanced"`
}

Conf is optional configuration for local 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 {
	Db *badgerv4.DB
	// contains filtered or unexported fields
}

Log implements the decisionlog interface with Badger as the backing store.

func NewLog

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

func (*Log) AccessLogEntriesBetween

func (l *Log) AccessLogEntriesBetween(ctx context.Context, fromTS, toTS time.Time) audit.AccessLogIterator

func (*Log) AccessLogEntryByID

func (l *Log) AccessLogEntryByID(ctx context.Context, id audit.ID) audit.AccessLogIterator

func (*Log) Backend added in v0.23.0

func (l *Log) Backend() string

func (*Log) Close

func (l *Log) Close() error

func (*Log) DecisionLogEntriesBetween

func (l *Log) DecisionLogEntriesBetween(ctx context.Context, fromTS, toTS time.Time) audit.DecisionLogIterator

func (*Log) DecisionLogEntryByID

func (l *Log) DecisionLogEntryByID(ctx context.Context, id audit.ID) audit.DecisionLogIterator

func (*Log) Enabled added in v0.23.0

func (l *Log) Enabled() bool

func (*Log) ForceWrite added in v0.35.0

func (l *Log) ForceWrite()

ForceWrite forces a write operation and blocks until completion. It is used only by tests.

func (*Log) LastNAccessLogEntries

func (l *Log) LastNAccessLogEntries(ctx context.Context, n uint) audit.AccessLogIterator

func (*Log) LastNDecisionLogEntries

func (l *Log) LastNDecisionLogEntries(ctx context.Context, n uint) audit.DecisionLogIterator

func (*Log) RegisterCallback added in v0.35.0

func (l *Log) RegisterCallback(fn func(chan<- struct{}))

func (*Log) Write added in v0.35.0

func (l *Log) Write(ctx context.Context, key, value []byte) error

func (*Log) WriteAccessLogEntry

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

func (*Log) WriteDecisionLogEntry

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

Jump to

Keyboard shortcuts

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