log_analyzer

package
v1.2.2-0...-a8c8fdf Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MulanPSL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeOb 结构化解析 observer 这类日志格式
	TypeOb = "ob"
	// TypeOb 轻量级解析 observer 这类日志格式(仅解析日志中时间戳、日志级别等)
	TypeObLight    = "ob_light"
	TypeAgent      = "agent"
	TypeAgentLight = "agent_light"
	TypeHost       = "host"
	TypeHostLight  = "host_light"
)

Variables

This section is empty.

Functions

func GetLogType

func GetLogType(fileName string) string

GetLogType 获取日志类型 observer election rootservice obproxy monagent mgragent 等 如传入 election.log.wf 返回

func ParseChan

func ParseChan(a LogAnalyzer, lines <-chan string, messages chan<- *message.Message) error

func ParseLines

func ParseLines(a LogAnalyzer, lineProvider func() (string, bool, error), msgConsumer func(*message.Message) bool) error

func ParseScanner

func ParseScanner(a LogAnalyzer, scanner *bufio.Scanner, msgConsumer func(*message.Message) bool) error

func ParseTimeFromFileName

func ParseTimeFromFileName(fileName string, delimiter string, pattern string, def time.Time) time.Time

Types

type AgentLogAnalyzer

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

func (*AgentLogAnalyzer) GetFileEndTime

func (a *AgentLogAnalyzer) GetFileEndTime(info os.FileInfo) (time.Time, error)

func (*AgentLogAnalyzer) ParseLine

func (a *AgentLogAnalyzer) ParseLine(line string) (*message.Message, bool)

type AgentLogLightAnalyzer

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

func (*AgentLogLightAnalyzer) GetFileEndTime

func (o *AgentLogLightAnalyzer) GetFileEndTime(info os.FileInfo) (time.Time, error)

GetFileEndTime 获取文件最后写入时间

func (*AgentLogLightAnalyzer) ParseLine

func (a *AgentLogLightAnalyzer) ParseLine(line string) (*message.Message, bool)

type HostLogAnalyzer

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

HostLogAnalyzer 主机日志

func (*HostLogAnalyzer) GetFileEndTime

func (o *HostLogAnalyzer) GetFileEndTime(info os.FileInfo) (time.Time, error)

GetFileEndTime 获取文件最后写入时间

func (*HostLogAnalyzer) ParseLine

func (o *HostLogAnalyzer) ParseLine(line string) (*message.Message, bool)

type HostLogLightAnalyzer

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

HostLogAnalyzer 主机日志

func (*HostLogLightAnalyzer) GetFileEndTime

func (o *HostLogLightAnalyzer) GetFileEndTime(info os.FileInfo) (time.Time, error)

GetFileEndTime 获取文件最后写入时间

func (*HostLogLightAnalyzer) ParseLine

func (o *HostLogLightAnalyzer) ParseLine(line string) (*message.Message, bool)

type LogAnalyzer

type LogAnalyzer interface {
	ParseLine(line string) (msg *message.Message, isNewLine bool)
	GetFileEndTime(logFile os.FileInfo) (time.Time, error)
}

func GetLogAnalyzer

func GetLogAnalyzer(typeName string, fileName string) LogAnalyzer

func NewAgentLogAnalyzer

func NewAgentLogAnalyzer(name string) LogAnalyzer

func NewAgentLogLightAnalyzer

func NewAgentLogLightAnalyzer(fileName string) LogAnalyzer

func NewHostLogAnalyzer

func NewHostLogAnalyzer(fileName string) LogAnalyzer

func NewHostLogLightAnalyzer

func NewHostLogLightAnalyzer(fileName string) LogAnalyzer

func NewObLogAnalyzer

func NewObLogAnalyzer(fileName string) LogAnalyzer

func NewObLogLightAnalyzer

func NewObLogLightAnalyzer(fileName string) LogAnalyzer

type LogAnalyzerFactory

type LogAnalyzerFactory func(fileName string) LogAnalyzer

type ObLogAnalyzer

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

func (*ObLogAnalyzer) GetFileEndTime

func (a *ObLogAnalyzer) GetFileEndTime(info os.FileInfo) (time.Time, error)

func (*ObLogAnalyzer) ParseLine

func (a *ObLogAnalyzer) ParseLine(line string) (*message.Message, bool)

type ObLogLightAnalyzer

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

func (*ObLogLightAnalyzer) GetFileEndTime

func (o *ObLogLightAnalyzer) GetFileEndTime(info os.FileInfo) (time.Time, error)

GetFileEndTime 获取文件最后写入时间 TODO 复用整合

func (*ObLogLightAnalyzer) ParseLine

func (o *ObLogLightAnalyzer) ParseLine(logLine string) (*message.Message, bool)

Jump to

Keyboard shortcuts

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