From 7b4af9d22992214f28490d41b3ddbfa61eeec2c5 Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Thu, 27 Oct 2016 12:07:30 +0200 Subject: [PATCH] Stop filebeat on error starting registrar (#2868) Currently when there is an error during loading the state, filebeat 5.0 doesn't stop and just continues. The registrar loading in filebeat 5.x was already improved an additional validation was added. This PR only changes that if there is an error in loading states, filebeat is not started and a proper error is returned. --- CHANGELOG.asciidoc | 3 ++- filebeat/beater/filebeat.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 83da8b902f2..1cf6601de85 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -8,7 +8,7 @@ // Template, add newest changes here === Beats version HEAD -https://github.com/elastic/beats/compare/v5.0.0-rc1...5.0[Check the HEAD diff] +https://github.com/elastic/beats/compare/v5.0.0...5.0[Check the HEAD diff] ==== Breaking changes @@ -51,6 +51,7 @@ https://github.com/elastic/beats/compare/v5.0.0-rc1...5.0[Check the HEAD diff] *Topbeat* *Filebeat* +- Stop Filebeat on registrar loading error. *Winlogbeat* diff --git a/filebeat/beater/filebeat.go b/filebeat/beater/filebeat.go index 4f9cac52569..041e15eef84 100644 --- a/filebeat/beater/filebeat.go +++ b/filebeat/beater/filebeat.go @@ -91,6 +91,7 @@ func (fb *Filebeat) Run(b *beat.Beat) error { err = registrar.Start() if err != nil { logp.Err("Could not start registrar: %v", err) + return err } // Stopping registrar will write last state defer registrar.Stop()