Skip to content

Commit

Permalink
add grok parser check
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderflow committed Jun 27, 2017
1 parent f7a79b9 commit d6c0ddd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions parser/grok_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ func (p *GrokParser) parseLine(line string) (sender.Data, error) {
data[k] = strings.Trim(v, `"`)
}
}

if len(data) <= 0 {
return data, fmt.Errorf("all data was ignored in this line? Check WARN log and fix your grok pattern")
}

for _, l := range p.labels {
data[l.name] = l.dataValue
}
Expand Down

0 comments on commit d6c0ddd

Please sign in to comment.