Skip to content

Commit

Permalink
Fix panic in logparser input (influxdata#4849)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and otherpirate committed Mar 15, 2019
1 parent 605926d commit e34f2d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/inputs/logparser/logparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,14 @@ func (l *LogParserPlugin) Start(acc telegraf.Accumulator) error {
l.done = make(chan struct{})
l.tailers = make(map[string]*tail.Tail)

mName := "logparser"
if l.GrokConfig.MeasurementName != "" {
mName = l.GrokConfig.MeasurementName
}

// Looks for fields which implement LogParser interface
config := &parsers.Config{
MetricName: mName,
GrokPatterns: l.GrokConfig.Patterns,
GrokNamedPatterns: l.GrokConfig.NamedPatterns,
GrokCustomPatterns: l.GrokConfig.CustomPatterns,
Expand Down Expand Up @@ -260,7 +266,7 @@ func (l *LogParserPlugin) parser() {
if m != nil {
tags := m.Tags()
tags["path"] = entry.path
l.acc.AddFields(l.GrokConfig.MeasurementName, m.Fields(), tags, m.Time())
l.acc.AddFields(m.Name(), m.Fields(), tags, m.Time())
}
} else {
log.Println("E! Error parsing log line: " + err.Error())
Expand Down

0 comments on commit e34f2d1

Please sign in to comment.