From 51fd6786da9c84703d7c11321878b03cef741949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 27 Oct 2021 15:24:59 +0200 Subject: [PATCH 1/4] rm auto option --- libbeat/idxmgmt/ilm/client_handler.go | 52 ++++++------------- .../ilm/client_handler_integration_test.go | 42 +++++---------- libbeat/idxmgmt/ilm/config.go | 44 ++-------------- libbeat/idxmgmt/ilm/ilm.go | 6 +-- libbeat/idxmgmt/ilm/ilm_test.go | 38 ++++---------- libbeat/idxmgmt/ilm/mockapihandler_test.go | 6 +-- libbeat/idxmgmt/ilm/noop.go | 2 +- libbeat/idxmgmt/ilm/std.go | 20 +++---- libbeat/idxmgmt/mockilm_test.go | 6 +-- libbeat/idxmgmt/std.go | 24 ++------- libbeat/idxmgmt/std_test.go | 23 +++----- 11 files changed, 73 insertions(+), 190 deletions(-) diff --git a/libbeat/idxmgmt/ilm/client_handler.go b/libbeat/idxmgmt/ilm/client_handler.go index d17af457ef4..9ec4cc218d0 100644 --- a/libbeat/idxmgmt/ilm/client_handler.go +++ b/libbeat/idxmgmt/ilm/client_handler.go @@ -28,7 +28,7 @@ import ( // ClientHandler defines the interface between a remote service and the Manager. type ClientHandler interface { - CheckILMEnabled(Mode) (bool, error) + CheckILMEnabled(bool) (bool, error) HasAlias(name string) (bool, error) CreateAlias(alias Alias) error @@ -92,40 +92,29 @@ func NewFileClientHandler(c FileClient) *FileClientHandler { } // CheckILMEnabled indicates whether or not ILM is supported for the configured mode and ES instance. -func (h *ESClientHandler) CheckILMEnabled(mode Mode) (bool, error) { - if mode == ModeDisabled { +func (h *ESClientHandler) CheckILMEnabled(enabled bool) (bool, error) { + if !enabled { return false, nil } - avail, probe := checkILMVersion(mode, h.client.GetVersion()) - if !avail { - if mode == ModeEnabled { - ver := h.client.GetVersion() - return false, errf(ErrESVersionNotSupported, - "Elasticsearch %v does not support ILM", ver.String()) - } - return false, nil - } - - if !probe { - // version potentially supports ILM, but mode + version indicates that we - // want to disable ILM support. - return false, nil + ver := h.client.GetVersion() + if !checkILMVersion(h.client.GetVersion()) { + return false, errf(ErrESVersionNotSupported, "Elasticsearch %v does not support ILM", ver.String()) } - avail, enabled, err := h.checkILMSupport() + avail, enabledILM, err := h.checkILMSupport() if err != nil { return false, err } if !avail { - if mode == ModeEnabled { + if enabledILM { return false, errOf(ErrESVersionNotSupported) } return false, nil } - if !enabled && mode == ModeEnabled { + if !enabledILM && enabled { return false, errOf(ErrESILMDisabled) } return enabled, nil @@ -244,18 +233,14 @@ func (h *ESClientHandler) queryFeatures(to interface{}) (int, error) { } // CheckILMEnabled indicates whether or not ILM is supported for the configured mode and client version. -func (h *FileClientHandler) CheckILMEnabled(mode Mode) (bool, error) { - if mode == ModeDisabled { - return false, nil - } - avail, probe := checkILMVersion(mode, h.client.GetVersion()) - if avail { - return probe, nil - } - if mode != ModeEnabled { +func (h *FileClientHandler) CheckILMEnabled(enabled bool) (bool, error) { + if !enabled { return false, nil } version := h.client.GetVersion() + if checkILMVersion(version) { + return enabled, nil + } return false, errf(ErrESVersionNotSupported, "Elasticsearch %v does not support ILM", version.String()) } @@ -287,11 +272,6 @@ func (h *FileClientHandler) HasAlias(name string) (bool, error) { // avail: indicates whether version supports ILM // probe: in case version potentially supports ILM, check the combination of mode + version // to indicate whether or not ILM support should be enabled or disabled -func checkILMVersion(mode Mode, ver common.Version) (avail, probe bool) { - avail = !ver.LessThan(esMinILMVersion) - if avail { - probe = (mode == ModeEnabled) || - (mode == ModeAuto && !ver.LessThan(esMinDefaultILMVersion)) - } - return avail, probe +func checkILMVersion(ver common.Version) (avail bool) { + return !ver.LessThan(esMinILMVersion) } diff --git a/libbeat/idxmgmt/ilm/client_handler_integration_test.go b/libbeat/idxmgmt/ilm/client_handler_integration_test.go index e8a7d7be713..b6f2755fd3d 100644 --- a/libbeat/idxmgmt/ilm/client_handler_integration_test.go +++ b/libbeat/idxmgmt/ilm/client_handler_integration_test.go @@ -48,21 +48,14 @@ const ( func TestESClientHandler_CheckILMEnabled(t *testing.T) { t.Run("no ilm if disabled", func(t *testing.T) { h := newESClientHandler(t) - b, err := h.CheckILMEnabled(ilm.ModeDisabled) + b, err := h.CheckILMEnabled(false) assert.NoError(t, err) assert.False(t, b) }) - t.Run("with ilm if auto", func(t *testing.T) { - h := newESClientHandler(t) - b, err := h.CheckILMEnabled(ilm.ModeAuto) - assert.NoError(t, err) - assert.True(t, b) - }) - t.Run("with ilm if enabled", func(t *testing.T) { h := newESClientHandler(t) - b, err := h.CheckILMEnabled(ilm.ModeEnabled) + b, err := h.CheckILMEnabled(true) assert.NoError(t, err) assert.True(t, b) }) @@ -268,38 +261,29 @@ func getEnv(name, def string) string { func TestFileClientHandler_CheckILMEnabled(t *testing.T) { for name, test := range map[string]struct { - m ilm.Mode - version string - enabled bool - err bool + enabled bool + version string + ilmEnabled bool + err bool }{ "ilm enabled": { - m: ilm.ModeEnabled, - enabled: true, - }, - "ilm auto": { - m: ilm.ModeAuto, - enabled: true, + enabled: true, + ilmEnabled: true, }, "ilm disabled": { - m: ilm.ModeDisabled, - enabled: false, + enabled: false, + ilmEnabled: false, }, "ilm enabled, version too old": { - m: ilm.ModeEnabled, + enabled: true, version: "5.0.0", err: true, }, - "ilm auto, version too old": { - m: ilm.ModeAuto, - version: "5.0.0", - enabled: false, - }, } { t.Run(name, func(t *testing.T) { h := ilm.NewFileClientHandler(newMockClient(test.version)) - b, err := h.CheckILMEnabled(test.m) - assert.Equal(t, test.enabled, b) + b, err := h.CheckILMEnabled(test.enabled) + assert.Equal(t, test.ilmEnabled, b) if test.err { assert.Error(t, err) } else { diff --git a/libbeat/idxmgmt/ilm/config.go b/libbeat/idxmgmt/ilm/config.go index de78cdbce55..f8e25f22f5b 100644 --- a/libbeat/idxmgmt/ilm/config.go +++ b/libbeat/idxmgmt/ilm/config.go @@ -19,8 +19,6 @@ package ilm import ( "fmt" - "strconv" - "strings" "github.com/elastic/beats/v7/libbeat/beat" "github.com/elastic/beats/v7/libbeat/common" @@ -29,7 +27,7 @@ import ( // Config is used for unpacking a common.Config. type Config struct { - Mode Mode `config:"enabled"` + Enabled bool `config:"enabled"` PolicyName fmtstr.EventFormatString `config:"policy_name"` PolicyFile string `config:"policy_file"` RolloverAlias fmtstr.EventFormatString `config:"rollover_alias"` @@ -44,20 +42,6 @@ type Config struct { Overwrite bool `config:"overwrite"` } -//Mode is used for enumerating the ilm mode. -type Mode uint8 - -const ( - //ModeAuto enum 'auto' - ModeAuto Mode = iota - - //ModeEnabled enum 'true' - ModeEnabled - - //ModeDisabled enum 'false' - ModeDisabled -) - const ilmDefaultPattern = "{now/d}-000001" // DefaultPolicy defines the default policy to be used if no custom policy is @@ -79,31 +63,9 @@ var DefaultPolicy = common.MapStr{ }, } -//Unpack creates enumeration value true, false or auto -func (m *Mode) Unpack(in string) error { - in = strings.ToLower(in) - - if in == "auto" { - *m = ModeAuto - return nil - } - - b, err := strconv.ParseBool(in) - if err != nil { - return fmt.Errorf("ilm.enabled` mode '%v' is invalid (try auto, true, false)", in) - } - - if b { - *m = ModeEnabled - } else { - *m = ModeDisabled - } - return nil -} - //Validate verifies that expected config options are given and valid func (cfg *Config) Validate() error { - if cfg.RolloverAlias.IsEmpty() && cfg.Mode != ModeDisabled { + if cfg.RolloverAlias.IsEmpty() && cfg.Enabled { return fmt.Errorf("rollover_alias must be set when ILM is not disabled") } return nil @@ -115,7 +77,7 @@ func defaultConfig(info beat.Info) Config { policyFmt := fmtstr.MustCompileEvent(info.Beat) return Config{ - Mode: ModeAuto, + Enabled: true, PolicyName: *policyFmt, RolloverAlias: *aliasFmt, Pattern: ilmDefaultPattern, diff --git a/libbeat/idxmgmt/ilm/ilm.go b/libbeat/idxmgmt/ilm/ilm.go index ac87161c481..a9e64e3cbd9 100644 --- a/libbeat/idxmgmt/ilm/ilm.go +++ b/libbeat/idxmgmt/ilm/ilm.go @@ -37,7 +37,7 @@ type SupportFactory func(*logp.Logger, beat.Info, *common.Config) (Supporter, er // write alias a manager instance must be generated. type Supporter interface { // Query settings - Mode() Mode + Enabled() bool Alias() Alias Policy() Policy Overwrite() bool @@ -82,7 +82,7 @@ func DefaultSupport(log *logp.Logger, info beat.Info, config *common.Config) (Su } } - if cfg.Mode == ModeDisabled { + if !cfg.Enabled { return NewNoopSupport(info, config) } @@ -137,7 +137,7 @@ func StdSupport(log *logp.Logger, info beat.Info, config *common.Config) (Suppor policy.Body = body } - return NewStdSupport(log, cfg.Mode, alias, policy, cfg.Overwrite, cfg.CheckExists), nil + return NewStdSupport(log, cfg.Enabled, alias, policy, cfg.Overwrite, cfg.CheckExists), nil } // NoopSupport configures a new noop ILM support implementation, diff --git a/libbeat/idxmgmt/ilm/ilm_test.go b/libbeat/idxmgmt/ilm/ilm_test.go index e61954fae10..196b48e08ba 100644 --- a/libbeat/idxmgmt/ilm/ilm_test.go +++ b/libbeat/idxmgmt/ilm/ilm_test.go @@ -31,27 +31,6 @@ import ( func TestDefaultSupport_Init(t *testing.T) { info := beat.Info{Beat: "test", Version: "9.9.9"} - t.Run("mode from config", func(t *testing.T) { - cases := map[string]Mode{ - "true": ModeEnabled, - "false": ModeDisabled, - "auto": ModeAuto, - } - for setting, expected := range cases { - expected := expected - t.Run(setting, func(t *testing.T) { - cfg := common.MustNewConfigFrom(map[string]interface{}{ - "enabled": setting, - "rollover_alias": "test", - }) - - s, err := DefaultSupport(nil, info, cfg) - require.NoError(t, err) - assert.Equal(t, expected, s.Mode()) - }) - } - }) - t.Run("with an empty rollover_alias", func(t *testing.T) { _, err := DefaultSupport(nil, info, common.MustNewConfigFrom( map[string]interface{}{ @@ -82,7 +61,7 @@ func TestDefaultSupport_Init(t *testing.T) { assert := assert.New(t) assert.Equal(true, s.overwrite) assert.Equal(false, s.checkExists) - assert.Equal(ModeEnabled, s.Mode()) + assert.Equal(true, s.Enabled()) assert.Equal(DefaultPolicy, common.MapStr(s.Policy().Body)) assert.Equal(Alias{Name: "alias", Pattern: "01"}, s.Alias()) }) @@ -103,7 +82,7 @@ func TestDefaultSupport_Init(t *testing.T) { assert := assert.New(t) assert.Equal(true, s.overwrite) assert.Equal(false, s.checkExists) - assert.Equal(ModeEnabled, s.Mode()) + assert.Equal(true, s.Enabled()) assert.Equal(DefaultPolicy, common.MapStr(s.Policy().Body)) assert.Equal(Alias{Name: "alias-9.9.9", Pattern: "01"}, s.Alias()) }) @@ -123,7 +102,7 @@ func TestDefaultSupport_Init(t *testing.T) { assert := assert.New(t) assert.Equal(true, s.overwrite) assert.Equal(false, s.checkExists) - assert.Equal(ModeEnabled, s.Mode()) + assert.Equal(true, s.Enabled()) assert.Equal(DefaultPolicy, common.MapStr(s.Policy().Body)) assert.Equal(Alias{Name: "test-9.9.9", Pattern: "01"}, s.Alias()) }) @@ -150,32 +129,33 @@ func TestDefaultSupport_Manager_Enabled(t *testing.T) { }, "disabled via handler": { calls: []onCall{ - onCheckILMEnabled(ModeAuto).Return(false, nil), + onCheckILMEnabled(true).Return(false, ErrESILMDisabled), }, + err: true, }, "enabled via handler": { calls: []onCall{ - onCheckILMEnabled(ModeAuto).Return(true, nil), + onCheckILMEnabled(true).Return(true, nil), }, enabled: true, }, "handler confirms enabled flag": { calls: []onCall{ - onCheckILMEnabled(ModeEnabled).Return(true, nil), + onCheckILMEnabled(true).Return(true, nil), }, cfg: map[string]interface{}{"enabled": true}, enabled: true, }, "fail enabled": { calls: []onCall{ - onCheckILMEnabled(ModeEnabled).Return(false, nil), + onCheckILMEnabled(true).Return(false, nil), }, cfg: map[string]interface{}{"enabled": true}, fail: ErrESILMDisabled, }, "io error": { calls: []onCall{ - onCheckILMEnabled(ModeAuto).Return(false, errors.New("ups")), + onCheckILMEnabled(true).Return(false, errors.New("ups")), }, cfg: map[string]interface{}{}, err: true, diff --git a/libbeat/idxmgmt/ilm/mockapihandler_test.go b/libbeat/idxmgmt/ilm/mockapihandler_test.go index a77f5086a3a..79148d83f1b 100644 --- a/libbeat/idxmgmt/ilm/mockapihandler_test.go +++ b/libbeat/idxmgmt/ilm/mockapihandler_test.go @@ -44,9 +44,9 @@ func newMockHandler(calls ...onCall) *mockHandler { return m } -func onCheckILMEnabled(m Mode) onCall { return makeOnCall("CheckILMEnabled", m) } -func (h *mockHandler) CheckILMEnabled(mode Mode) (bool, error) { - args := h.Called(mode) +func onCheckILMEnabled(enabled bool) onCall { return makeOnCall("CheckILMEnabled", enabled) } +func (h *mockHandler) CheckILMEnabled(enabled bool) (bool, error) { + args := h.Called(enabled) return args.Bool(0), args.Error(1) } diff --git a/libbeat/idxmgmt/ilm/noop.go b/libbeat/idxmgmt/ilm/noop.go index b516acf8ace..20586a261d3 100644 --- a/libbeat/idxmgmt/ilm/noop.go +++ b/libbeat/idxmgmt/ilm/noop.go @@ -31,7 +31,7 @@ func NewNoopSupport(info beat.Info, config *common.Config) (Supporter, error) { return (*noopSupport)(nil), nil } -func (*noopSupport) Mode() Mode { return ModeDisabled } +func (*noopSupport) Enabled() bool { return false } func (*noopSupport) Alias() Alias { return Alias{} } func (*noopSupport) Policy() Policy { return Policy{} } func (*noopSupport) Overwrite() bool { return false } diff --git a/libbeat/idxmgmt/ilm/std.go b/libbeat/idxmgmt/ilm/std.go index 2065e72c84f..6363898a0a1 100644 --- a/libbeat/idxmgmt/ilm/std.go +++ b/libbeat/idxmgmt/ilm/std.go @@ -26,7 +26,7 @@ import ( type stdSupport struct { log *logp.Logger - mode Mode + enabled bool overwrite bool checkExists bool @@ -52,14 +52,14 @@ var defaultCacheDuration = 5 * time.Minute // NewStdSupport creates an instance of default ILM support implementation. func NewStdSupport( log *logp.Logger, - mode Mode, + enabled bool, alias Alias, policy Policy, overwrite, checkExists bool, ) Supporter { return &stdSupport{ log: log, - mode: mode, + enabled: enabled, overwrite: overwrite, checkExists: checkExists, alias: alias, @@ -67,7 +67,7 @@ func NewStdSupport( } } -func (s *stdSupport) Mode() Mode { return s.mode } +func (s *stdSupport) Enabled() bool { return s.enabled } func (s *stdSupport) Alias() Alias { return s.alias } func (s *stdSupport) Policy() Policy { return s.policy } func (s *stdSupport) Overwrite() bool { return s.overwrite } @@ -80,7 +80,7 @@ func (s *stdSupport) Manager(h ClientHandler) Manager { } func (m *stdManager) CheckEnabled() (bool, error) { - if m.mode == ModeDisabled { + if !m.enabled { return false, nil } @@ -88,18 +88,18 @@ func (m *stdManager) CheckEnabled() (bool, error) { return m.cache.Enabled, nil } - enabled, err := m.client.CheckILMEnabled(m.mode) + ilmEnabled, err := m.client.CheckILMEnabled(m.enabled) if err != nil { - return enabled, err + return ilmEnabled, err } - if !enabled && m.mode == ModeEnabled { + if !ilmEnabled && m.enabled { return false, errOf(ErrESILMDisabled) } - m.cache.Enabled = enabled + m.cache.Enabled = ilmEnabled m.cache.LastUpdate = time.Now() - return enabled, nil + return ilmEnabled, nil } func (m *stdManager) EnsureAlias() error { diff --git a/libbeat/idxmgmt/mockilm_test.go b/libbeat/idxmgmt/mockilm_test.go index 6022ad843b4..d138b46e6a0 100644 --- a/libbeat/idxmgmt/mockilm_test.go +++ b/libbeat/idxmgmt/mockilm_test.go @@ -51,10 +51,10 @@ func (c onCall) Return(values ...interface{}) onCall { return c } -func onMode() onCall { return makeOnCall("Mode") } -func (m *mockILMSupport) Mode() ilm.Mode { +func onEnabled() onCall { return makeOnCall("Enabled") } +func (m *mockILMSupport) Enabled() bool { args := m.Called() - return args.Get(0).(ilm.Mode) + return args.Get(0).(bool) } func onAlias() onCall { return makeOnCall("Alias") } diff --git a/libbeat/idxmgmt/std.go b/libbeat/idxmgmt/std.go index 99cf5890353..6cca4dad683 100644 --- a/libbeat/idxmgmt/std.go +++ b/libbeat/idxmgmt/std.go @@ -136,7 +136,7 @@ func (s *indexSupport) enabled(c componentType) bool { case componentTemplate: return s.templateCfg.Enabled case componentILM: - return s.ilm.Mode() != ilm.ModeDisabled + return s.ilm.Enabled() } return false } @@ -177,13 +177,9 @@ func (s *indexSupport) BuildSelector(cfg *common.Config) (outputs.IndexSelector, } } - var alias string - mode := s.ilm.Mode() - if mode != ilm.ModeDisabled { - alias = s.ilm.Alias().Name + if s.ilm.Enabled() { + alias := s.ilm.Alias().Name log.Infof("Set %v to '%s' as ILM is enabled.", cfg.PathOf("index"), alias) - } - if mode == ilm.ModeEnabled { indexName = alias } @@ -198,7 +194,7 @@ func (s *indexSupport) BuildSelector(cfg *common.Config) (outputs.IndexSelector, Key: "index", MultiKey: "indices", EnableSingleOnly: true, - FailEmpty: mode != ilm.ModeEnabled, + FailEmpty: !s.ilm.Enabled(), Case: outil.SelectorLowerCase, } @@ -207,17 +203,7 @@ func (s *indexSupport) BuildSelector(cfg *common.Config) (outputs.IndexSelector, return nil, err } - if mode != ilm.ModeAuto { - return indexSelector{indexSel, s.info}, nil - } - - selCfg.SetString("index", -1, alias) - aliasSel, err := outil.BuildSelectorFromConfig(selCfg, buildSettings) - return &ilmIndexSelector{ - index: indexSel, - alias: aliasSel, - st: &s.st, - }, nil + return indexSelector{indexSel, s.info}, nil } func (m *indexManager) VerifySetup(loadTemplate, loadILM LoadMode) (bool, string) { diff --git a/libbeat/idxmgmt/std_test.go b/libbeat/idxmgmt/std_test.go index 3e934d78d58..76b0ac9879e 100644 --- a/libbeat/idxmgmt/std_test.go +++ b/libbeat/idxmgmt/std_test.go @@ -59,7 +59,7 @@ func TestDefaultSupport_Enabled(t *testing.T) { "templates and ilm disabled": { enabled: false, ilmCalls: []onCall{ - onMode().Return(ilm.ModeDisabled), + onEnabled().Return(false), }, cfg: map[string]interface{}{ "setup.template.enabled": false, @@ -68,7 +68,7 @@ func TestDefaultSupport_Enabled(t *testing.T) { "templates only": { enabled: true, ilmCalls: []onCall{ - onMode().Return(ilm.ModeDisabled), + onEnabled().Return(false), }, cfg: map[string]interface{}{ "setup.template.enabled": true, @@ -77,16 +77,7 @@ func TestDefaultSupport_Enabled(t *testing.T) { "ilm only": { enabled: true, ilmCalls: []onCall{ - onMode().Return(ilm.ModeEnabled), - }, - cfg: map[string]interface{}{ - "setup.template.enabled": false, - }, - }, - "ilm tentatively": { - enabled: true, - ilmCalls: []onCall{ - onMode().Return(ilm.ModeAuto), + onEnabled().Return(true), }, cfg: map[string]interface{}{ "setup.template.enabled": false, @@ -107,10 +98,10 @@ func TestDefaultSupport_Enabled(t *testing.T) { func TestDefaultSupport_BuildSelector(t *testing.T) { type nameFunc func(time.Time) string - noILM := []onCall{onMode().Return(ilm.ModeDisabled)} + noILM := []onCall{onEnabled().Return(false)} ilmTemplateSettings := func(alias, policy string) []onCall { return []onCall{ - onMode().Return(ilm.ModeEnabled), + onEnabled().Return(true), onAlias().Return(ilm.Alias{Name: alias}), onPolicy().Return(ilm.Policy{Name: policy}), } @@ -512,8 +503,8 @@ func (h *mockClientHandler) Load(config template.TemplateConfig, _ beat.Info, fi return nil } -func (h *mockClientHandler) CheckILMEnabled(m ilm.Mode) (bool, error) { - return m == ilm.ModeEnabled || m == ilm.ModeAuto, nil +func (h *mockClientHandler) CheckILMEnabled(enabled bool) (bool, error) { + return enabled, nil } func (h *mockClientHandler) HasAlias(name string) (bool, error) { From af292c4368f670767ad38f5a509050e15fc55bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 27 Oct 2021 15:26:32 +0200 Subject: [PATCH 2/4] add docs --- libbeat/docs/shared-ilm.asciidoc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libbeat/docs/shared-ilm.asciidoc b/libbeat/docs/shared-ilm.asciidoc index 853ccb2c543..7d5dda17439 100644 --- a/libbeat/docs/shared-ilm.asciidoc +++ b/libbeat/docs/shared-ilm.asciidoc @@ -26,7 +26,7 @@ Example configuration: ["source","yaml",subs="attributes"] ---- -setup.ilm.enabled: auto +setup.ilm.enabled: true setup.ilm.rollover_alias: "{beatname_lc}" setup.ilm.pattern: "{now/d}-000001" <1> ---- @@ -47,10 +47,7 @@ You can specify the following settings in the `setup.ilm` section of the ==== `setup.ilm.enabled` Enables or disables index lifecycle management on any new indices created by -{beatname_uc}. Valid values are `true`, `false`, and `auto`. When `auto` (the -default) is specified on version 7.0 and later, {beatname_uc} automatically uses -index lifecycle management if the feature is enabled in {es} and has the -required license; otherwise, {beatname_uc} creates daily indices. +{beatname_uc}. Valid values are `true` and `false`. [float] [[setup-ilm-rollover_alias-option]] From 472c873529e02cbeeef7e216b6ccec2da8b7bca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 27 Oct 2021 15:47:07 +0200 Subject: [PATCH 3/4] add changelog entry --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index d8e8b320023..dfed995a70b 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -27,6 +27,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Enable IMDSv2 support for `add_cloud_metadata` processor on AWS. {issue}22101[22101] {pull}28285[28285] - Update kubernetes.namespace from keyword to group field and add name, labels, annotations, uuid as its fields {pull}27917[27917] - Previously, RE2 and thus Golang had a bug where `(|a)*` matched more characters than `(|a)+`. To stay consistent with PCRE, the bug was fixed. Configurations that rely on the old, buggy behaviour has to be adjusted. See more about Golang bug: https://github.com/golang/go/issues/46123 {pull}27543[27543] +- Remove `auto` from the available options of `setup.ilm.enabled` and set the default value to `true`. {pull}28671[28671] *Auditbeat* From 18c749dfd646460f49bb03f4e79c1b0f1d1d2099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Thu, 28 Oct 2021 10:00:15 +0200 Subject: [PATCH 4/4] follow up change in test --- libbeat/outputs/elasticsearch/client_integration_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libbeat/outputs/elasticsearch/client_integration_test.go b/libbeat/outputs/elasticsearch/client_integration_test.go index 2b05f8a3cdb..c2d1299d920 100644 --- a/libbeat/outputs/elasticsearch/client_integration_test.go +++ b/libbeat/outputs/elasticsearch/client_integration_test.go @@ -420,7 +420,8 @@ func connectTestEs(t *testing.T, cfg interface{}, stats outputs.Observer) (outpu } info := beat.Info{Beat: "libbeat"} - im, _ := idxmgmt.DefaultSupport(nil, info, nil) + // disable ILM if using specified index name + im, _ := idxmgmt.DefaultSupport(nil, info, common.MustNewConfigFrom(map[string]interface{}{"setup.ilm.enabled": "false"})) output, err := makeES(im, info, stats, config) if err != nil { t.Fatal(err)