From 3f830ed0b4a2d335365f3f0d2a8453fbc2eeca12 Mon Sep 17 00:00:00 2001 From: Adrian Serrano Date: Mon, 9 Apr 2018 12:00:11 +0200 Subject: [PATCH] Fix panic in log harvester error handling When the log harvester initialisation fails (i.e. due to wrong configuration), it causes a panic instead of reporting the error. Fixes #6800 --- CHANGELOG.asciidoc | 2 ++ filebeat/input/log/input.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 0d02b8770673..4fb2f751e938 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -57,6 +57,8 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di *Filebeat* +- Fix panic when log prospector configuration fails to load. {issue}6800[6800] + *Heartbeat* *Metricbeat* diff --git a/filebeat/input/log/input.go b/filebeat/input/log/input.go index 531611dd2507..bffe042a4191 100644 --- a/filebeat/input/log/input.go +++ b/filebeat/input/log/input.go @@ -585,7 +585,9 @@ func (p *Input) createHarvester(state file.State, onTerminate func()) (*Harveste }, outlet, ) - h.onTerminate = onTerminate + if err == nil { + h.onTerminate = onTerminate + } return h, err }