pattern

package
v0.0.0-...-332dcef Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DrainCluster

type DrainCluster struct {
	ID      uuid.UUID
	Pattern string
	Count   int
}

DrainCluster represents a discovered log template.

func MatchTemplate

func MatchTemplate(line string, templates []DrainCluster) (DrainCluster, bool)

MatchTemplate finds the best matching template for a log line by comparing tokens against template patterns (where "<*>" is a wildcard). Returns the matched template and true, or zero-value and false if no match.

type DrainParser

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

DrainParser uses the Drain algorithm to discover log templates online.

func NewDrainParser

func NewDrainParser() (*DrainParser, error)

NewDrainParser creates a DrainParser with default Drain parameters.

func (*DrainParser) Feed

func (p *DrainParser) Feed(ctx context.Context, contents []string) error

Feed processes a batch of log lines through the Drain algorithm.

func (*DrainParser) Templates

func (p *DrainParser) Templates(ctx context.Context) ([]DrainCluster, error)

Templates returns all Drain clusters discovered so far with their counts.

Jump to

Keyboard shortcuts

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