Fix detection of layout timestamps (#6390)

This commit is contained in:
Daniel Nelson
2019-09-16 16:32:14 -07:00
committed by GitHub
parent 7167a23c52
commit 6dc61be6eb
4 changed files with 215 additions and 77 deletions

View File

@@ -235,7 +235,7 @@ func parseTimestamp(timeFunc func() time.Time, recordFields map[string]interface
case "":
return time.Time{}, fmt.Errorf("timestamp format must be specified")
default:
metricTime, err := internal.ParseTimestamp(recordFields[timestampColumn], timestampFormat)
metricTime, err := internal.ParseTimestamp(timestampFormat, recordFields[timestampColumn], "UTC")
if err != nil {
return time.Time{}, err
}

View File

@@ -120,7 +120,7 @@ func (p *Parser) parseObject(data map[string]interface{}) ([]telegraf.Metric, er
return nil, err
}
nTime, err = internal.ParseTimestampWithLocation(f.Fields[p.timeKey], p.timeFormat, p.timezone)
nTime, err = internal.ParseTimestamp(p.timeFormat, f.Fields[p.timeKey], p.timezone)
if err != nil {
return nil, err
}