parseLog parses one log line.
(log *systemlogtypes.Log)
| 149 | |
| 150 | // parseLog parses one log line. |
| 151 | func (l *logMonitor) parseLog(log *systemlogtypes.Log) { |
| 152 | // Once there is new log, log monitor will push it into the log buffer and try |
| 153 | // to match each rule. If any rule is matched, log monitor will report a status. |
| 154 | l.buffer.Push(log) |
| 155 | for _, rule := range l.config.Rules { |
| 156 | matched := l.buffer.Match(rule.Pattern) |
| 157 | if len(matched) == 0 { |
| 158 | continue |
| 159 | } |
| 160 | status := l.generateStatus(matched, rule) |
| 161 | klog.Infof("New status generated: %+v", status) |
| 162 | l.output <- status |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | // generateStatus generates status from the logs. |
| 167 | func (l *logMonitor) generateStatus(logs []*systemlogtypes.Log, rule systemlogtypes.Rule) *types.Status { |
no test coverage detected