From 316417a632970c30ab0dab3a45336219b0428c96 Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Fri, 6 Oct 2017 09:18:51 +0200 Subject: [PATCH] Do not require template if index change and template disabled (#5319) (#5334) * Do not require template if index change and template disabled If the elasticsearch index name is changed, its required to set a template. The error message was also shown when template itself are disabled. This is now changed that if templates are disabled, no error is returned. Closes https://github.com/elastic/beats/issues/5308 * Add Changelog (cherry picked from commit ce9e47b83ab5a7dd09c99832cdcf0ebdbc485cb0) --- CHANGELOG.asciidoc | 1 + libbeat/cmd/instance/beat.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 1769d624f7f..34079435f7f 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -33,6 +33,7 @@ https://github.com/elastic/beats/compare/v6.0.0-rc1...master[Check the HEAD diff *Affecting all Beats* - Fix data race accessing watched containers. {issue}5147[5147] +- Do not require template if index change and template disabled {pull}5319[5319] *Auditbeat* diff --git a/libbeat/cmd/instance/beat.go b/libbeat/cmd/instance/beat.go index a69addce09d..e7636289acb 100644 --- a/libbeat/cmd/instance/beat.go +++ b/libbeat/cmd/instance/beat.go @@ -572,7 +572,7 @@ func (b *Beat) registerTemplateLoading() error { return err } - if esCfg.Index != "" && (cfg.Name == "" || cfg.Pattern == "") { + if esCfg.Index != "" && (cfg.Name == "" || cfg.Pattern == "") && (b.Config.Template == nil || b.Config.Template.Enabled()) { return fmt.Errorf("setup.template.name and setup.template.pattern have to be set if index name is modified.") }