From 1e8a5b8d5d5658f67b0862fd3c04c28768521d16 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Thu, 23 Jul 2020 12:46:03 -0400 Subject: [PATCH] Don't swallow Kibana index pattern errors (#20121) (#20194) While running 'beat setup --dashboads' any errors that occur while importing the generated Kibana index pattern or silently ignored. This changes that by causing the dashboard setup to stop and return the error. Dashboards won't work without the index pattern anyways. (cherry picked from commit 543349c7161aa1b66ea1f73a76c58de0844e8503) --- CHANGELOG.next.asciidoc | 1 + libbeat/dashboards/importer.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 5ffbe0d4c69..6eec352b6b4 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -91,6 +91,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Change `decode_json_fields` processor, to merge parsed json objects with existing objects in the event instead of fully replacing them. {pull}17958[17958] - Fix terminating pod autodiscover issue. {pull}20084[20084] - Fix seccomp policy for calls to `chmod` and `chown`. {pull}20054[20054] +- Output errors when Kibana index pattern setup fails. {pull}20121[20121] *Auditbeat* diff --git a/libbeat/dashboards/importer.go b/libbeat/dashboards/importer.go index eb399ba1b3d..178a5837284 100644 --- a/libbeat/dashboards/importer.go +++ b/libbeat/dashboards/importer.go @@ -300,7 +300,9 @@ func (imp Importer) ImportKibanaDir(dir string) error { // Loads the internal index pattern if imp.fields != nil { - imp.loader.ImportIndex(imp.fields) + if err = imp.loader.ImportIndex(imp.fields); err != nil { + return errw.Wrap(err, "failed to import Kibana index pattern") + } } dir = path.Join(dir, versionPath)