Fix syslog timestamp parsing with single digit day of month (#4334)

This commit is contained in:
Daniel Nelson
2018-06-29 18:05:46 -07:00
committed by GitHub
parent beaef8e3da
commit 9bd5e10133
2 changed files with 35 additions and 10 deletions

View File

@@ -293,7 +293,7 @@ func (p *Parser) ParseLine(line string) (telegraf.Metric, error) {
timestamp = time.Unix(0, iv)
}
case SYSLOG_TIMESTAMP:
ts, err := time.ParseInLocation("Jan 02 15:04:05", v, p.loc)
ts, err := time.ParseInLocation(time.Stamp, v, p.loc)
if err == nil {
if ts.Year() == 0 {
ts = ts.AddDate(timestamp.Year(), 0, 0)