filter

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionContext added in v1.4.0

type ActionContext struct {
	Kevt   *kevent.Kevent
	Filter *config.FilterConfig
	Group  config.FilterGroup
}

ActionContext is the convenient structure for grouping the event that resulted in matched filter along with filter group information.

type Filter

type Filter interface {
	// Compile compiles the filter by parsing the filtering expression.
	Compile() error
	// Run runs a filter on the inbound kernel event and decides whether the event should be dropped or propagated to the downstream channel.
	Run(kevt *kevent.Kevent) bool
}

Filter is the main interface for the filter engine implementors.

func New

func New(expr string, config *config.Config) Filter

New creates a new filter with the specified filter expression. The consumers must ensure the expression is correctly parsed before executing the filter. This is achieved by calling the Compile` method after constructing the filter.

func NewFromCLI

func NewFromCLI(args []string, config *config.Config) (Filter, error)

NewFromCLI builds and compiles a filter by joining all the command line arguments into the filter expression.

func NewFromCLIWithAllAccessors

func NewFromCLIWithAllAccessors(args []string) (Filter, error)

NewFromCLIWithAllAccessors builds and compiles a filter with all field accessors enabled.

type Rules added in v1.4.0

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

Rules stores the compiled filter groups and for each incoming event, it applies the corresponding filtering policies to the event, dropping the event or passing it accordingly. If the filter rule has an action, the former is executed when the rule fires.

func NewRules added in v1.4.0

func NewRules(c *config.Config) Rules

NewRules produces a fresh rules instance.

func (*Rules) Compile added in v1.4.0

func (r *Rules) Compile() error

Compile loads the filter groups from all files and creates the filters for each filter group.

func (*Rules) Fire added in v1.4.0

func (r *Rules) Fire(kevt *kevent.Kevent) bool

Directories

Path Synopsis
ql

Jump to

Keyboard shortcuts

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