Documentation ¶
Index ¶
Constants ¶
View Source
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 regular expression in the log buffer. Match(string) []*types.Log // String returns a concatenated string of the buffered logs. String() string }
LogBuffer buffers the logs and supports match in the log buffer with regular expression.
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()
ApplyConfiguration applies default configurations.
func (MonitorConfig) ValidateRules ¶ added in v0.5.0
func (mc MonitorConfig) ValidateRules() error
ValidateRules verifies whether the regular expressions in the rules are valid.
Click to show internal directories.
Click to hide internal directories.