From 7a7279fd789d2296dd8c9123bb66b74669d0da51 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Tue, 21 Jul 2020 19:55:23 -0400 Subject: [PATCH] Don't swallow Kibana index pattern errors (#20121) 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. --- 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 a3e645d1197b..b9ac5a369bfe 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -148,6 +148,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix metrics hints builder to avoid wrong container metadata usage when port is not exposed {pull}18979[18979] - Server-side TLS config now validates certificate and key are both specified {pull}19584[19584] - 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 bf08fcd327f0..0c56d073d916 100644 --- a/libbeat/dashboards/importer.go +++ b/libbeat/dashboards/importer.go @@ -305,7 +305,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)