Skip to content

Commit

Permalink
Fix panic on Metricbeat filters (#4328)
Browse files Browse the repository at this point in the history
`nil` can happen if the event is dropped by processors. Fixes #4327.
  • Loading branch information
tsg authored and ruflin committed May 17, 2017
1 parent 7f378cf commit 8bec232
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ https://github.com/elastic/beats/compare/v6.0.0-alpha1...master[Check the HEAD d
*Metricbeat*
- Fix a debug statement that said a module wrapper had stopped when it hadn't. {pull}4264[4264]
- Use MemAvailable value from /proc/meminfo on Linux 3.14. {pull}4316[4316]
- Fix panic when events were dropped by filters. {issue}4327[4327]

*Packetbeat*

Expand Down
9 changes: 6 additions & 3 deletions metricbeat/mb/module/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,13 @@ func (r *eventReporter) ErrorWith(err error, meta common.MapStr) bool {
return false
}

if !writeEvent(r.done, r.out, event) {
return false
if event != nil { // event can be nil if it was dropped by processors
if !writeEvent(r.done, r.out, event) {
return false
}
r.msw.stats.events.Add(1)
}
r.msw.stats.events.Add(1)

return true
}

Expand Down

0 comments on commit 8bec232

Please sign in to comment.