Documentation
¶
Index ¶
Constants ¶
const SystemLogMonitorName = "system-log-monitor"
Variables ¶
This section is empty.
Functions ¶
func NewLogBuffer ¶
func NewLogBuffer(maxLines int) *logBuffer
NewLogBuffer creates log buffer with max line number limit. Because we only match logs in the log buffer, the max buffer line number is also the max pattern line number we support. Smaller buffer line number means less memory and cpu usage, but also means less lines of patterns we support.
func NewLogMonitorOrDie ¶
NewLogMonitorOrDie create a new LogMonitor, panic if error occurs.
Types ¶
type LogBuffer ¶
type LogBuffer interface {
// Push pushes log into the log buffer.
Push(*types.Log)
// Match with a compiled pattern in the log buffer.
Match(*Pattern) []*types.Log
}
LogBuffer buffers the logs and matches a compiled pattern.
type MonitorConfig ¶
type MonitorConfig struct {
// WatcherConfig is the configuration of log watcher.
watchertypes.WatcherConfig
// BufferSize is the size (in lines) of the log buffer.
BufferSize int `json:"bufferSize"`
// Source is the source name of the log monitor
Source string `json:"source"`
// DefaultConditions are the default states of all the conditions log monitor should handle.
DefaultConditions []types.Condition `json:"conditions"`
// Rules are the rules log monitor will follow to parse the log file.
Rules []systemlogtypes.Rule `json:"rules"`
// EnableMetricsReporting describes whether to report problems as metrics or not.
EnableMetricsReporting *bool `json:"metricsReporting,omitempty"`
}
MonitorConfig is the configuration of log monitor.
func (*MonitorConfig) ApplyDefaultConfiguration ¶ added in v0.5.0
func (mc *MonitorConfig) ApplyDefaultConfiguration()
ApplyDefaultConfiguration applies default configurations.
type Pattern ¶ added in v1.37.0
type Pattern struct {
// contains filtered or unexported fields
}
Pattern is a compiled rule plus the facts that let Match narrow its scan.
func CompilePattern ¶ added in v1.37.0
CompilePattern compiles a log buffer pattern that must match to the end of the buffered logs.