classification

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeParserStats added in v1.8.0

func MergeParserStats(dst map[string]*ParserStats, src map[string]*ParserStats)

Types

type Classifier

type Classifier struct {
	// contains filtered or unexported fields
}

Classifier is the struct responsible for classifying logs

func (*Classifier) Classify

func (c *Classifier) Classify(log string) (*ClassifierResult, error)

Classify attempts to classify the provided log line

func (*Classifier) ParserStats

func (c *Classifier) ParserStats() map[string]*ParserStats

func (*Classifier) Stats

func (c *Classifier) Stats() *ClassifierStats

type ClassifierAPI

type ClassifierAPI interface {
	// Classify attempts to classify the provided log line
	Classify(log string) (*ClassifierResult, error)
	// aggregate stats
	Stats() *ClassifierStats
	// per-parser stats, map of LogType -> stats
	ParserStats() map[string]*ParserStats
}

ClassifierAPI is the interface for a classifier

func NewClassifier

func NewClassifier(parsers map[string]parsers.Interface) ClassifierAPI

NewClassifier returns a new instance of a ClassifierAPI implementation

type ClassifierResult

type ClassifierResult struct {
	// Events contains the parsed events
	// If the classification process was not successful and the log is from an
	// unsupported type, this will be nil
	Events []*parsers.Result
	// Matched signifies that the classifier matched the log entry
	Matched bool
	// NumMiss counts the number for failed classification attempts
	NumMiss int
}

ClassifierResult is the result of the ClassifierAPI#Classify method

type ClassifierStats

type ClassifierStats struct {
	ClassifyTimeMicroseconds    uint64 // total time parsing
	BytesProcessedCount         uint64 // input bytes
	LogLineCount                uint64 // input records
	EventCount                  uint64 // output records
	SuccessfullyClassifiedCount uint64
	ClassificationFailureCount  uint64
}

aggregate stats

func (*ClassifierStats) Add added in v1.8.0

func (s *ClassifierStats) Add(other *ClassifierStats)

type ParserPriorityQueue

type ParserPriorityQueue struct {
	// contains filtered or unexported fields
}

ParserPriorityQueue contains parsers in priority order

func NewParserPriorityQueue added in v1.5.1

func NewParserPriorityQueue(parsers map[string]parsers.Interface) *ParserPriorityQueue

func (*ParserPriorityQueue) Len

func (q *ParserPriorityQueue) Len() int

Len returns the length of the priority queue

func (*ParserPriorityQueue) Less

func (q *ParserPriorityQueue) Less(i, j int) bool

Less compares two items of the priority queue

func (*ParserPriorityQueue) Peek

Peek returns the item with the higher priority without removing it

func (*ParserPriorityQueue) Pop

func (q *ParserPriorityQueue) Pop() interface{}

Pop removes the last element of the queue

func (*ParserPriorityQueue) Push

func (q *ParserPriorityQueue) Push(x interface{})

Push adds an element to the end of the SchemaQueue

func (*ParserPriorityQueue) Swap

func (q *ParserPriorityQueue) Swap(i, j int)

Swap swaps two items in the priority queue

type ParserQueueItem

type ParserQueueItem struct {
	// contains filtered or unexported fields
}

ParserQueueItem contains all the information needed to initialize a schema.

type ParserStats

type ParserStats struct {
	ParserTimeMicroseconds uint64 // total time parsing
	BytesProcessedCount    uint64 // input bytes
	LogLineCount           uint64 // input records
	EventCount             uint64 // output records
	CombinedLatency        uint64 // sum of latency of events
	LogType                string
}

per parser stats

func (*ParserStats) Add added in v1.8.0

func (s *ParserStats) Add(other *ParserStats)

Jump to

Keyboard shortcuts

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