preprocessors

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package preprocessors provides log pre processors

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(parser parsers.Interface, preProcessors ...Interface) parsers.Interface

Wrap wraps a parser and executes a preprocessing pipeline before the log entry is parsed.

Types

type CSVMatchConfig

type CSVMatchConfig struct {
	Delimiter string `json:"delimiter" yaml:"delimiter" description:"Delimiter to split the CSV file."`
	// Setting this to true will use column names from the first line unless `columns` field is set as well, overriding names in the header
	HasHeader    bool              `json:"hasHeader,omitempty" yaml:"hasHeader,omitempty" description:"Use first row to derive column names"`
	TrimSpace    bool              `json:"trimSpace,omitempty" yaml:"trimSpace,omitempty" description:"Trim space surrounding values"`
	Columns      []string          `` /* 147-byte string literal not displayed */
	SkipPrefix   string            `json:"skipPrefix,omitempty" yaml:"skipPrefix,omitempty" description:"Skip comment lines by prefix"`
	EmptyValues  []string          `json:"emptyValues,omitempty" yaml:"emptyValues,omitempty" description:"Placeholder value for empty or missing data"`
	ExpandFields map[string]string `json:"expandFields,omitempty" yaml:"expandFields,omitempty" description:"Add fields by text templates"`
}

nolint:lll

func (CSVMatchConfig) BuildPreprocessor

func (config CSVMatchConfig) BuildPreprocessor() (Interface, error)

type FastMatchConfig

type FastMatchConfig struct {
	Match        []string          `json:"match" yaml:"match" description:"Patterns to match in order"`
	SkipLines    int               `json:"skipLines,omitempty" yaml:"skipLines,omitempty" description:"Number of lines to skip at start of file"`
	SkipPrefix   string            `json:"skipPrefix,omitempty" yaml:"skipPrefix,omitempty" description:"Skip comment lines by prefix"`
	EmptyValues  []string          `json:"emptyValues,omitempty" yaml:"emptyValues,omitempty" description:"Placeholder value for empty or missing data"`
	ExpandFields map[string]string `json:"expandFields,omitempty" yaml:"expandFields,omitempty" description:"Add fields by text templates"`
	TrimSpace    bool              `json:"trimSpace,omitempty" yaml:"trimSpace,omitempty" description:"Trim space surrounding values"`
}

nolint:lll

func (FastMatchConfig) BuildPreprocessor

func (config FastMatchConfig) BuildPreprocessor() (Interface, error)

type Interface

type Interface interface {
	PreProcessLog(log string) (string, error)
}

Interface handles processing of a log line *before* it is parsed as JSON to produce a log event.

func Nop

func Nop() Interface

Nop is a preprocessor that doesn't modify the log entry.

func Pipeline

func Pipeline(preProcessors ...Interface) Interface

Pipeline applies pre-processors in order.

type RegexConfig

type RegexConfig struct {
	PatternDefinitions map[string]string `json:"patternDefinitions,omitempty" yaml:"patternDefinitions,omitempty" description:"Additional pattern definitions"`
	Match              []string          `json:"match" yaml:"match" description:"Pattern to match against in chunks"`
	SkipLines          int               `json:"skipLines,omitempty" yaml:"skipLines,omitempty" description:"Number of lines to skip at start of file"`
	SkipPrefix         string            `json:"skipPrefix,omitempty" yaml:"skipPrefix,omitempty" description:"Skip comment lines by prefix"`
	EmptyValues        []string          `json:"emptyValues,omitempty" yaml:"emptyValues,omitempty" description:"Placeholder value for empty or missing data"`
	ExpandFields       map[string]string `json:"expandFields,omitempty" yaml:"expandFields,omitempty" description:"Add fields by text templates"`
	TrimSpace          bool              `json:"trimSpace,omitempty" yaml:"trimSpace,omitempty" description:"Trim space surrounding values"`
}

nolint:lll

func (RegexConfig) BuildPreprocessor

func (config RegexConfig) BuildPreprocessor() (Interface, error)

Jump to

Keyboard shortcuts

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