Documentation ¶
Index ¶
- func FluentBitSpecialFields() map[string]string
- func LuaQuote(in string) string
- func ParseTextOrString(a Attrib) (string, error)
- func UnquoteString(in string) (string, error)
- func UnquoteTextOrString(in string) (string, error)
- type Attrib
- type Conjunction
- type Disjunction
- type Expression
- type Negation
- type Restriction
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FluentBitSpecialFields ¶
func ParseTextOrString ¶
func UnquoteString ¶
UnquoteString replaces all escape sequences with their respective characters that they represent.
It assumes the leading and trailing double-quotes have been removed.
Escape sequences are replaced if and only if they are defined in our grammar: confgenerator/filter/internal/filter.bnf. An error is returned if an unrecognized escape sequence is encountered.
This is a compatibility layer to maintain parity with Cloud Logging query strings. strconv.Unquote cannot be used here because it follows escape rules for Go strings, and Cloud Logging strings are not Go strings.
func UnquoteTextOrString ¶
UnquoteTextOrString returns text literals as-is and unquotes string literals.
Types ¶
type Conjunction ¶
type Conjunction []Expression
Conjunction represents an AND expression
func NewConjunction ¶
func NewConjunction(a Attrib) (Conjunction, error)
func (Conjunction) Append ¶
func (c Conjunction) Append(a Attrib) (Conjunction, error)
func (Conjunction) FluentConfig ¶
func (c Conjunction) FluentConfig(tag, key string) ([]fluentbit.Component, string)
func (Conjunction) OTTLExpression ¶
func (c Conjunction) OTTLExpression() (ottl.Value, error)
func (Conjunction) Simplify ¶
func (c Conjunction) Simplify() Expression
func (Conjunction) String ¶
func (c Conjunction) String() string
type Disjunction ¶
type Disjunction []Expression
Disjunction represents an OR expression
func NewDisjunction ¶
func NewDisjunction(a Attrib) (Disjunction, error)
func (Disjunction) Append ¶
func (d Disjunction) Append(a Attrib) (Disjunction, error)
func (Disjunction) FluentConfig ¶
func (d Disjunction) FluentConfig(tag, key string) ([]fluentbit.Component, string)
func (Disjunction) OTTLExpression ¶
func (d Disjunction) OTTLExpression() (ottl.Value, error)
func (Disjunction) Simplify ¶
func (d Disjunction) Simplify() Expression
func (Disjunction) String ¶
func (d Disjunction) String() string
type Expression ¶
type Expression interface { // Simplify returns a logically equivalent Expression. Simplify() Expression // FluentConfig returns an optional sequence of fluentbit operations and a Lua expression that can be evaluated to determine if the expression matches the record. FluentConfig(tag, key string) ([]fluentbit.Component, string) // OTTLExpression returns an OTTL value that can be used to evaluate the expression. OTTLExpression() (ottl.Value, error) fmt.Stringer }
func Simplify ¶
func Simplify(a Attrib) (Expression, error)
type Negation ¶
type Negation struct {
Expression
}
func (Negation) FluentConfig ¶
func (Negation) Simplify ¶
func (n Negation) Simplify() Expression
type Restriction ¶
type Restriction struct { Operator string // LHS contains the field being matched LHS Target // RHS contains the string to match against; for regexes, this is a raw string including escape sequences (but always without double quotes). RHS string }
func NewRestriction ¶
func NewRestriction(lhs, operator, rhs Attrib) (*Restriction, error)
func (Restriction) FluentConfig ¶
func (r Restriction) FluentConfig(tag, key string) ([]fluentbit.Component, string)
func (Restriction) OTTLExpression ¶
func (r Restriction) OTTLExpression() (ottl.Value, error)
func (Restriction) Simplify ¶
func (r Restriction) Simplify() Expression
func (Restriction) String ¶
func (r Restriction) String() string
type Target ¶
type Target []string
Target represents member from the filter BNF, and represents either a value or a dotted field path. Each element of the slice is not yet unescaped (if needed).
func (Target) Equals ¶
Equals checks if two valid targets are equal. Invalid targets are never equal.
func (Target) LuaAccessor ¶
LuaAccessor returns the value of the target (with write=false) or a function that takes one argument to set the target (with write=true).
func (Target) OTTLAccessor ¶
OTTLAccessor returns a string that can be used to refer to the field in OTTL
func (Target) RecordAccessor ¶
RecordAccessor returns a string that can be used as a key in a FluentBit config