Allow grok to produce metrics with no fields (#5533)

This commit is contained in:
Daniel Nelson
2019-03-05 11:07:39 -08:00
committed by GitHub
parent 1dcfecdb59
commit a0527db037
3 changed files with 55 additions and 40 deletions

View File

@@ -11,10 +11,9 @@ import (
"strings"
"time"
"github.com/vjeantet/grok"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/metric"
"github.com/vjeantet/grok"
)
var timeLayouts = map[string]string{
@@ -361,10 +360,6 @@ func (p *Parser) ParseLine(line string) (telegraf.Metric, error) {
}
}
if len(fields) == 0 {
return nil, fmt.Errorf("grok: must have one or more fields")
}
if p.UniqueTimestamp != "auto" {
return metric.New(p.Measurement, tags, fields, timestamp)
}