Documentation
¶
Overview ¶
provides fast matching algorithms TODO: aho-corasic on substring matching
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Type string `json:"type"` // Event identifier.
Desc string `json:"desc"` // Event description
Severity string `json:"severity"` // Event severity (INFO, WARN, ERROR)
Info map[string]interface{} `json:"info"` // Aribtrary data specific to this event
Process string `json:"process"` // The process that generated this event
common.MessageCommon
}
func (*Event) MustPublish ¶
type EventHandler ¶
type EventParser ¶
type EventParser struct {
Substring string // substring unique to this log record for efficient matching
Re string // regex to use for matching
Sample string // sample log record
Handler EventHandler // event handler
}
type EventParserGroup ¶
type EventParserGroup map[string]*EventParser
EventParserGroup is a group of event parsers, which group is matched in a single attempt, independent of other groups.
type EventParserSpec ¶
type EventParserSpec struct {
Substring string `json:"substring"`
Re string `json:"regex"`
Sample string `json:"sample"`
Format string `json:"format"`
Severity string `json:"severity"`
HandlerType string `json:"handlertype"`
}
TODO: somehow merge this redundant struct with EventParser.
func (*EventParserSpec) ToEventParser ¶
func (p *EventParserSpec) ToEventParser() *EventParser
type JsonEventHandler ¶
SimpleEventHandler assigns event description formatted based on fields of JSON extracted from the first and only regex match group
func NewJsonEventHandler ¶
func NewJsonEventHandler(severity string, descTmpl string) JsonEventHandler
func (JsonEventHandler) HandleEvent ¶
func (handler JsonEventHandler) HandleEvent(results []string, event *Event) error
type MultiRegexpMatcher ¶
type MultiRegexpMatcher struct {
// contains filtered or unexported fields
}
MultiRegexpMatch allows matching a string against multiple regular expressions along with substrings for a fast fail-early matching.
func NewMultiRegexpMatcher ¶
func NewMultiRegexpMatcher() *MultiRegexpMatcher
func (*MultiRegexpMatcher) Build ¶
func (m *MultiRegexpMatcher) Build()
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(tree map[string]EventParserGroup) Parser
func NewStackatoParser ¶
func NewStackatoParser(spec map[string]map[string]EventParserSpec) Parser
func (Parser) DeleteSamples ¶
func (parser Parser) DeleteSamples()
DeleteSamples deletes the samples (EventParser.Sample) to free up some memory.
type SimpleEventHandler ¶
SimpleEventHandler assigns event description formatted based on regex groups
func NewSimpleEventHandler ¶
func NewSimpleEventHandler(severity string, descTmpl string) SimpleEventHandler
func (SimpleEventHandler) HandleEvent ¶
func (handler SimpleEventHandler) HandleEvent(results []string, event *Event) error