Beispiel #1
0
func (f *Automatic) GetParser(line []byte) syslogparser.LogParser {
	switch format, _ := detect(line); format {
	case detectedRFC3164:
		return rfc3164.NewParser(line)
	case detectedRFC5424:
		return rfc5424.NewParser(line)
	default:
		// If the line was an RFC6587 line, the splitter should already have removed the length,
		// so one of the above two will be chosen if the line is correctly formed. However, it
		// may have a second length illegally placed at the start, in which case the detector
		// will return detectedRFC6587. The line may also simply be malformed after the length in
		// which case we will have detectedUnknown. In this case we return the simplest parser so
		// the illegally formatted line is properly handled
		return rfc3164.NewParser(line)
	}
}
Beispiel #2
0
func (f *RFC5424) GetParser(line []byte) syslogparser.LogParser {
	return rfc5424.NewParser(line)
}