Documentation
¶
Overview ¶
Package ruleset handles loading and basic validation of rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AggDtx ¶
type AggDtx struct {
Match string `yaml:"match" validate:"required"`
ExtMatch []string `yaml:"extended_match"`
Aggregation string `yaml:"aggregation" validate:"required"`
Projections map[string]string `yaml:"projections"`
RawGroupBy []string `yaml:"group_by" validate:"required,min=1"`
Timespan time.Duration `yaml:"timespan" validate:"required"`
Slide time.Duration `yaml:"slide"`
Timeout time.Duration `yaml:"timeout"`
EventTime *EventTime `yaml:"event_time"`
EmitSuppressed bool `yaml:"emit_suppressed"`
GroupBy [][]string `yaml:"-"`
}
type CompositeDtx ¶
type CompositeDtx struct {
Timespan time.Duration `yaml:"timespan" validate:"required"`
TTL time.Duration `yaml:"ttl"`
AllowedLateness time.Duration `yaml:"allowed_lateness"`
Timeout time.Duration `yaml:"timeout"`
Ordered bool `yaml:"ordered"`
Parts []Part `yaml:"parts" validate:"required,min=2,dive"`
EmitSuppressed bool `yaml:"emit_suppressed"`
}
type CompositeEventTime ¶
type Part ¶
type Part struct {
Name string `yaml:"name" validate:"required"`
Rule RuleID `yaml:"rule" validate:"required"`
RawGroupBy []string `yaml:"group_by" validate:"required,min=1"`
RawStore []string `yaml:"store"`
EventTime *CompositeEventTime `yaml:"event_time"`
GroupBy [][]string `yaml:"-"`
Store [][]string `yaml:"-"`
}
type RiskEntry ¶
type RiskEntry struct {
EntityType string `yaml:"entity_type" validate:"required" json:"entity_type"`
RawField string `yaml:"field" validate:"required" json:"field"`
Score float64 `yaml:"score" validate:"required,gt=0" json:"score"`
Part string `yaml:"part" json:"part,omitempty"`
Normalize string `yaml:"normalize" json:"normalize,omitempty"`
Scaling *float64 `yaml:"scaling" json:"scaling,omitempty" validate:"omitempty,gte=0,lte=1"`
TTL time.Duration `yaml:"ttl" json:"ttl,omitempty" validate:"gte=0"`
Decay DecayType `yaml:"decay" json:"decay,omitempty" validate:"omitempty,oneof=none linear"`
Field []string `yaml:"-" json:"-"`
}
func (*RiskEntry) EffectiveScaling ¶
type Rule ¶
type Rule struct {
ID RuleID `yaml:"id" validate:"required" json:"id"`
Title string `yaml:"title" validate:"required" json:"title"`
Type RuleType `yaml:"type" validate:"required,oneof=event aggregation composite" json:"type"`
Level RuleLevel `yaml:"level" validate:"required,oneof=critical high medium low info" json:"level"`
Status RuleStatus `yaml:"status" validate:"required,oneof=stable experimental testing deprecated" json:"status"`
Description string `yaml:"description" validate:"required" json:"description"`
Tags []string `yaml:"tags" json:"tags,omitempty"`
References []string `yaml:"references" json:"references,omitempty"`
Alert *bool `yaml:"alert" json:"alert,omitempty"`
Scopes []string `yaml:"scopes" json:"scopes,omitempty"`
Risk []RiskEntry `yaml:"risk" json:"-"`
Detection yaml.RawMessage `yaml:"detection" validate:"required" json:"-"`
File string `yaml:"-" json:"file,omitempty"`
EventDtx *EventDtx `yaml:"-" json:"-"`
AggDtx *AggDtx `yaml:"-" json:"-"`
CompositeDtx *CompositeDtx `yaml:"-" json:"-"`
}
func (*Rule) AlertEnabled ¶
type RuleStatus ¶
type RuleStatus string
const ( StatusStable RuleStatus = "stable" StatusExperimental RuleStatus = "experimental" StatusTesting RuleStatus = "testing" StatusDeprecated RuleStatus = "deprecated" )
Click to show internal directories.
Click to hide internal directories.