Documentation ¶
Index ¶
- Variables
- type CompressorSeekWrapper
- type Logfile
- func (l *Logfile) AddPattern(level MonitoringResult, pattern string) error
- func (l *Logfile) AddPatterns(level MonitoringResult, patterns []string) error
- func (l *Logfile) Close() (err error)
- func (l *Logfile) Offset() int64
- func (l *Logfile) Scan() (res MonitoringResult, counts [MonitorCount]int64, err error)
- type MonitoringResult
- type ReadSeekCloser
Constants ¶
This section is empty.
Variables ¶
var ErrStreamSeek = errors.New("cannot seek to this position in stream")
Functions ¶
This section is empty.
Types ¶
type CompressorSeekWrapper ¶
type CompressorSeekWrapper struct {
// contains filtered or unexported fields
}
We can skip IO and rewind in streams and thus support the io.Seeker interface
func NewCompressorSeekWrapper ¶
func NewCompressorSeekWrapper(backend ReadSeekCloser, compression string) *CompressorSeekWrapper
wrapper around compressors that supports streams
func (*CompressorSeekWrapper) Close ¶
func (c *CompressorSeekWrapper) Close() error
Satisfy io.Closer interface
type Logfile ¶
type Logfile struct {
// contains filtered or unexported fields
}
Abstracts away a logfile event classificator
func NewLogFile ¶
func NewLogFile(r ReadSeekCloser, start int64) *Logfile
Start managing logfile r at start. If start is invalid, we seek to the current end.
func (*Logfile) AddPattern ¶
func (l *Logfile) AddPattern(level MonitoringResult, pattern string) error
Add a regexp pattern to trigger monitoring alert level. Logfile lines are matched in order of appearance, but which pattern is applied first is not specified.
func (*Logfile) AddPatterns ¶
func (l *Logfile) AddPatterns(level MonitoringResult, patterns []string) error
Add list of a regexp patterns to trigger monitoring alert level. Logfile lines are matched in order of appearance, but which patterns are applied first is not specified.
func (*Logfile) Scan ¶
func (l *Logfile) Scan() (res MonitoringResult, counts [MonitorCount]int64, err error)
Scan logfile until end for supplied patterns. In res you can find the monitoring level to be reported, counts contains useful statistics and err is any error that accours. io.EOF is not reported as error, since this function is supposed to scan right until io.EOF in the good case. Empty files generate MonitorOk, unreadable files MonitorUnknown, everything else depends on which pattern the last read line matches.
type MonitoringResult ¶
type MonitoringResult int
Result to be reported to a monitoring system
const ( MonitorOk MonitoringResult = iota // No remaining issues MonitorWarning MonitorCritical MonitorUnknown // Cannot determine state MonitorCount // Upper bound for arrays based on levels )
func (MonitoringResult) String ¶
func (m MonitoringResult) String() string