drain3

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDepth

func WithDepth(depth int64) optionFn

func WithExtraDelimiter

func WithExtraDelimiter(extraDelimiter []string) optionFn

func WithMaxChildren

func WithMaxChildren(maxChildren int64) optionFn

func WithMaxCluster

func WithMaxCluster(maxClusters int) optionFn

func WithSimTh

func WithSimTh(simTh float64) optionFn

Types

type ClusterUpdateType

type ClusterUpdateType int
const (
	ClusterUpdateTypeNone ClusterUpdateType = iota
	ClusterUpdateTypeCreated
	ClusterUpdateTypeTemplateChanged
)

type Drain

type Drain struct {
	LogClusterDepth          int64
	MaxNodeDepth             int64
	SimTh                    float64
	MaxChildren              int64
	RootNode                 *Node
	MaxClusters              int
	ExtraDelimiters          []string
	ParamStr                 string
	ParametrizeNumericTokens bool

	IdToCluster     *lru.Cache[int64, *LogCluster] `json:"-"`
	ClustersCounter int64
}

func NewDrain

func NewDrain(options ...optionFn) (*Drain, error)

func (*Drain) AddLogMessage

func (d *Drain) AddLogMessage(content string) (*LogCluster, ClusterUpdateType, error)

func (*Drain) GetClusters

func (d *Drain) GetClusters() []*LogCluster

func (*Drain) MarshalJSON

func (d *Drain) MarshalJSON() ([]byte, error)

func (*Drain) Match

func (d *Drain) Match(content string, strategy SearchStrategy) (*LogCluster, error)

func (*Drain) PrintTree

func (d *Drain) PrintTree(maxClusters int)

func (*Drain) UnmarshalJSON

func (d *Drain) UnmarshalJSON(data []byte) error

type ExtractedParameter

type ExtractedParameter struct {
	Value    string
	MaskName string
}

type FilePersistence

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

func NewFilePersistence

func NewFilePersistence(filePath string) *FilePersistence

func (*FilePersistence) LoadState

func (p *FilePersistence) LoadState() ([]byte, error)

func (*FilePersistence) SaveState

func (p *FilePersistence) SaveState(state []byte) error

type LogCluster

type LogCluster struct {
	ClusterId         int64
	LogTemplateTokens []string
	Size              int64
}

func NewLogCluster

func NewLogCluster(clusterId int64, logTemplateTokens []string) *LogCluster

func (*LogCluster) GetTemplate

func (l *LogCluster) GetTemplate() string

func (*LogCluster) String

func (l *LogCluster) String() string

type MemoryPersistence

type MemoryPersistence struct {
	State []byte
}

func NewMemoryPersistence

func NewMemoryPersistence() *MemoryPersistence

func (*MemoryPersistence) Load

func (p *MemoryPersistence) Load(_ context.Context) ([]byte, error)

func (*MemoryPersistence) Save

func (p *MemoryPersistence) Save(_ context.Context, state []byte) error

type Node

type Node struct {
	KeyToChildNode map[string]*Node
	ClusterIds     []int64
}

func NewNode

func NewNode() *Node

type PersistenceHandler

type PersistenceHandler interface {
	Save(ctx context.Context, state []byte) error
	Load(ctx context.Context) ([]byte, error)
}

type SearchStrategy

type SearchStrategy int
const (
	SearchStrategyNever SearchStrategy = iota
	SearchStrategyFallback
	SearchStrategyAlways
)

type SerializableDrain

type SerializableDrain struct {
	LogClusterDepth          int64
	MaxNodeDepth             int64
	SimTh                    float64
	MaxChildren              int64
	RootNode                 *Node
	MaxClusters              int
	ExtraDelimiters          []string
	ParamStr                 string
	ParametrizeNumericTokens bool

	Clusters        []*LogCluster
	ClustersCounter int64
}

type TemplateMiner

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

func NewTemplateMiner

func NewTemplateMiner(drain *Drain, persistence PersistenceHandler) *TemplateMiner

func (*TemplateMiner) AddLogMessage

func (m *TemplateMiner) AddLogMessage(ctx context.Context, content string) (ClusterUpdateType, *LogCluster, string, int, error)

func (*TemplateMiner) ExtractParameters

func (m *TemplateMiner) ExtractParameters(logTemplate, logMessage string) []*ExtractedParameter

func (*TemplateMiner) GetParameterList

func (m *TemplateMiner) GetParameterList(logTemplate, logMessage string) []string

func (*TemplateMiner) LoadState

func (m *TemplateMiner) LoadState(ctx context.Context) error

func (*TemplateMiner) Match

func (m *TemplateMiner) Match(content string, strategy SearchStrategy) (*LogCluster, error)

func (*TemplateMiner) SaveState

func (m *TemplateMiner) SaveState(ctx context.Context) error

Jump to

Keyboard shortcuts

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