Documentation ¶
Index ¶
- type Config
- type Grok
- func (g *Grok) AddPattern(name, pattern string) error
- func (g *Grok) AddPatternsFromMap(m map[string]string) error
- func (g *Grok) AddPatternsFromPath(path string) error
- func (g *Grok) Match(pattern, text string) (bool, error)
- func (g *Grok) Parse(pattern, text string) (map[string]string, error)
- func (g *Grok) ParseStream(reader *bufio.Reader, pattern string, process func(map[string]string) error) error
- func (g *Grok) ParseToMultiMap(pattern, text string) (map[string][]string, error)
- func (g *Grok) ParseTyped(pattern string, text string) (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { NamedCapturesOnly bool SkipDefaultPatterns bool RemoveEmptyValues bool PatternsDir []string Patterns map[string]string }
A Config structure is used to configure a Grok parser.
type Grok ¶
type Grok struct {
// contains filtered or unexported fields
}
Grok object us used to load patterns and deconstruct strings using those patterns.
func NewWithConfig ¶
NewWithConfig returns a Grok object that is configured to behave according to the supplied Config structure.
func (*Grok) AddPattern ¶
AddPattern adds a named pattern to grok
func (*Grok) AddPatternsFromMap ¶
AddPatternsFromMap loads a map of named patterns
func (*Grok) AddPatternsFromPath ¶
AddPatternsFromPath adds new patterns from the files in the specified directory to the list of loaded patterns.
func (*Grok) ParseStream ¶
func (g *Grok) ParseStream(reader *bufio.Reader, pattern string, process func(map[string]string) error) error
ParseStream will match the given pattern on a line by line basis from the reader and apply the results to the process function
func (*Grok) ParseToMultiMap ¶
ParseToMultiMap parses the specified text and returns a map with the results. Values are stored in an string slice, so values from captures with the same name don't get overridden.