Allow grok to produce metrics with no fields (#5533)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user