From ce9e47b83ab5a7dd09c99832cdcf0ebdbc485cb0 Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Thu, 5 Oct 2017 11:39:13 +0200 Subject: [PATCH] Do not require template if index change and template disabled (#5319) * 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 --- 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 126d9df0632..becbbb5e4f9 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -34,6 +34,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di - Fix data race accessing watched containers. {issue}5147[5147] - Remove ID() from Runner interface {issue}5153[5153] +- 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 731f9330109..62671b01c62 100644 --- a/libbeat/cmd/instance/beat.go +++ b/libbeat/cmd/instance/beat.go @@ -575,7 +575,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.") }