diff --git a/libbeat/idxmgmt/idxmgmt.go b/libbeat/idxmgmt/idxmgmt.go index 9b65d64529d..97e58fcb52a 100644 --- a/libbeat/idxmgmt/idxmgmt.go +++ b/libbeat/idxmgmt/idxmgmt.go @@ -107,6 +107,11 @@ func MakeDefaultSupport(ilmSupport lifecycle.SupportFactory) SupportFactory { return func(log *logp.Logger, info beat.Info, configRoot *config.C) (Supporter, error) { const logName = "index-management" + if log == nil { + log = logp.NewLogger(logName) + } else { + log = log.Named(logName) + } // first fetch the ES output, check if we're running against serverless, use that to set a default config. // the Supporter only cares about lifecycle config for checking if ILM/DSL is enabled or disabled. @@ -151,12 +156,6 @@ func MakeDefaultSupport(ilmSupport lifecycle.SupportFactory) SupportFactory { } } - if log == nil { - log = logp.NewLogger(logName) - } else { - log = log.Named(logName) - } - if err := checkTemplateESSettings(cfg.Template, cfg.Output); err != nil { return nil, err } diff --git a/libbeat/idxmgmt/std_test.go b/libbeat/idxmgmt/std_test.go index 05296182a98..697556b4cd1 100644 --- a/libbeat/idxmgmt/std_test.go +++ b/libbeat/idxmgmt/std_test.go @@ -313,6 +313,7 @@ func TestIndexManager_Setup(t *testing.T) { info := beat.Info{Beat: "test", Version: "9.9.9"} defaultCfg := template.DefaultConfig(info) defaultLifecycleConfig := lifecycle.DefaultILMConfig(info) + dslLifecycleConfig := lifecycle.DefaultDSLConfig(info) cases := map[string]struct { cfg mapstr.M loadTemplate, loadILM LoadMode @@ -331,6 +332,16 @@ func TestIndexManager_Setup(t *testing.T) { policy: "test", ilmCfg: defaultLifecycleConfig, }, + "template-default-dsl-config": { + tmplCfg: cfgWith(template.DefaultConfig(info), map[string]interface{}{ + "overwrite": "true", + "name": "test-9.9.9", + "pattern": "test-9.9.9", + "settings.index.lifecycle.name": "test-9.9.9", + }), + policy: "test-9.9.9", + ilmCfg: dslLifecycleConfig, + }, "template default ilm default with policy changed": { cfg: mapstr.M{ "setup.ilm.policy_name": "policy-keep", diff --git a/libbeat/tests/system/test_ilm.py b/libbeat/tests/system/test_ilm.py index 1f2b89ac562..630ab551593 100644 --- a/libbeat/tests/system/test_ilm.py +++ b/libbeat/tests/system/test_ilm.py @@ -13,7 +13,7 @@ INTEGRATION_TESTS = os.environ.get('INTEGRATION_TESTS', False) -MSG_ILM_POLICY_LOADED = re.compile('ILM policy .* successfully created.') +MSG_ILM_POLICY_LOADED = re.compile('lifecycle policy .* successfully created.') class TestRunILM(BaseTest):