diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index f2acad353a9..2a6ae34a7cd 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -28,6 +28,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - add_docker_metadata processor: Replace usage of deprecated `process.ppid` field with `process.parent.pid`. {pull}28620[28620] - Index template's default_fields setting is only populated with ECS fields. {pull}28596[28596] {issue}28215[28215] - Remove `auto` from the available options of `setup.ilm.enabled` and set the default value to `true`. {pull}28671[28671] +- Remove deprecated `--template` and `--ilm-policy` flags. Use `--index-management` instead. {pull}28870[28870] - Remove options `logging.files.suffix` and default to datetime endings. {pull}28927[28927] *Auditbeat* diff --git a/auditbeat/tests/system/test_base.py b/auditbeat/tests/system/test_base.py index 3a007eb4f87..2f7f645c750 100644 --- a/auditbeat/tests/system/test_base.py +++ b/auditbeat/tests/system/test_base.py @@ -35,9 +35,9 @@ def test_start_stop(self): assert self.log_contains("auditbeat stopped") @unittest.skipUnless(INTEGRATION_TESTS, "integration test") - def test_template(self): + def test_index_management(self): """ - Test that the template can be loaded with `setup --template` + Test that the template can be loaded with `setup --index-management` """ dirs = [self.temp_dir("auditbeat_test")] with PathCleanup(dirs): @@ -51,7 +51,7 @@ def test_template(self): } }], elasticsearch={"host": self.get_elasticsearch_url()}) - self.run_beat(extra_args=["setup", "--template"], exit_code=0) + self.run_beat(extra_args=["setup", "--index-management"], exit_code=0) assert self.log_contains('Loaded index template') assert len(es.cat.templates(name='auditbeat-*', h='name')) > 0 diff --git a/filebeat/tests/system/test_base.py b/filebeat/tests/system/test_base.py index a55fb279459..6082c07f609 100644 --- a/filebeat/tests/system/test_base.py +++ b/filebeat/tests/system/test_base.py @@ -28,31 +28,15 @@ def test_base(self): assert "input.type" in output @unittest.skipUnless(INTEGRATION_TESTS, "integration test") - def test_template(self): + def test_index_management(self): """ - Test that the template can be loaded with `setup --template` + Test that the template can be loaded with `setup --index-management` """ es = Elasticsearch([self.get_elasticsearch_url()]) self.render_config_template( elasticsearch={"host": self.get_elasticsearch_url()}, ) - exit_code = self.run_beat(extra_args=["setup", "--template"]) - - assert exit_code == 0 - assert self.log_contains('Loaded index template') - assert len(es.cat.templates(name='filebeat-*', h='name')) > 0 - - @unittest.skipUnless(INTEGRATION_TESTS, "integration test") - def test_template_migration(self): - """ - Test that the template can be loaded with `setup --template` - """ - es = Elasticsearch([self.get_elasticsearch_url()]) - self.render_config_template( - elasticsearch={"host": self.get_elasticsearch_url()}, - ) - exit_code = self.run_beat(extra_args=["setup", "--template", - "-E", "setup.template.overwrite=true", "-E", "migration.6_to_7.enabled=true"]) + exit_code = self.run_beat(extra_args=["setup", "--index-management"]) assert exit_code == 0 assert self.log_contains('Loaded index template') diff --git a/heartbeat/cmd/root.go b/heartbeat/cmd/root.go index 5a99e97c56f..06f3961c279 100644 --- a/heartbeat/cmd/root.go +++ b/heartbeat/cmd/root.go @@ -18,7 +18,6 @@ package cmd import ( - "fmt" // include all heartbeat specific autodiscovery builders _ "github.com/elastic/beats/v7/heartbeat/autodiscover/builder/hints" @@ -80,10 +79,6 @@ func Initialize(settings instance.Settings) *cmd.BeatsRootCmd { ` setup.ResetFlags() setup.Flags().Bool(cmd.IndexManagementKey, false, "Setup all components related to Elasticsearch index management, including template, ilm policy and rollover alias") - setup.Flags().MarkDeprecated(cmd.TemplateKey, fmt.Sprintf("use --%s instead", cmd.IndexManagementKey)) - setup.Flags().MarkDeprecated(cmd.ILMPolicyKey, fmt.Sprintf("use --%s instead", cmd.IndexManagementKey)) - setup.Flags().Bool(cmd.TemplateKey, false, "Setup index template") - setup.Flags().Bool(cmd.ILMPolicyKey, false, "Setup ILM policy") return rootCmd } diff --git a/heartbeat/tests/system/test_base.py b/heartbeat/tests/system/test_base.py index 141658049fb..172960209d3 100644 --- a/heartbeat/tests/system/test_base.py +++ b/heartbeat/tests/system/test_base.py @@ -194,9 +194,9 @@ def run_fields(self, expected, local=None, top=None): return doc @unittest.skipUnless(INTEGRATION_TESTS, "integration test") - def test_template(self): + def test_index_management(self): """ - Test that the template can be loaded with `setup --template` + Test that the template can be loaded with `setup --index-management` """ es = Elasticsearch([self.get_elasticsearch_url()]) self.render_config_template( @@ -206,7 +206,7 @@ def test_template(self): }], elasticsearch={"host": self.get_elasticsearch_url()}, ) - exit_code = self.run_beat(extra_args=["setup", "--template"]) + exit_code = self.run_beat(extra_args=["setup", "--index-management"]) assert exit_code == 0 assert self.log_contains('Loaded index template') diff --git a/libbeat/cmd/setup.go b/libbeat/cmd/setup.go index 711ddfd027c..01c2b110a6b 100644 --- a/libbeat/cmd/setup.go +++ b/libbeat/cmd/setup.go @@ -34,16 +34,6 @@ const ( PipelineKey = "pipelines" //IndexManagementKey used for loading all components related to ES index management in setup cmd IndexManagementKey = "index-management" - - //TemplateKey used for loading template in setup cmd - // - //Deprecated: use IndexManagementKey instead - TemplateKey = "template" - - //ILMPolicyKey used for loading ilm in setup cmd - // - //Deprecated: use IndexManagementKey instead - ILMPolicyKey = "ilm-policy" ) func genSetupCmd(settings instance.Settings, beatCreator beat.Creator) *cobra.Command { @@ -68,8 +58,6 @@ func genSetupCmd(settings instance.Settings, beatCreator beat.Creator) *cobra.Co DashboardKey: false, PipelineKey: false, IndexManagementKey: false, - TemplateKey: false, - ILMPolicyKey: false, } var setupAll = true @@ -100,10 +88,6 @@ func genSetupCmd(settings instance.Settings, beatCreator beat.Creator) *cobra.Co s.Pipeline = true case IndexManagementKey: s.IndexManagement = true - case ILMPolicyKey: - s.ILMPolicy = true - case TemplateKey: - s.Template = true } } } @@ -118,10 +102,6 @@ func genSetupCmd(settings instance.Settings, beatCreator beat.Creator) *cobra.Co setup.Flags().Bool(PipelineKey, false, "Setup Ingest pipelines") setup.Flags().Bool(IndexManagementKey, false, "Setup all components related to Elasticsearch index management, including template, ilm policy and rollover alias") - setup.Flags().Bool(TemplateKey, false, "Setup index template") - setup.Flags().MarkDeprecated(TemplateKey, fmt.Sprintf("please use --%s instead", IndexManagementKey)) - setup.Flags().Bool(ILMPolicyKey, false, "Setup ILM policy") - setup.Flags().MarkDeprecated(ILMPolicyKey, fmt.Sprintf("please use --%s instead", IndexManagementKey)) return &setup } diff --git a/libbeat/docs/command-reference.asciidoc b/libbeat/docs/command-reference.asciidoc index 833f698682d..38cc5937ff0 100644 --- a/libbeat/docs/command-reference.asciidoc +++ b/libbeat/docs/command-reference.asciidoc @@ -802,16 +802,6 @@ ifdef::apm-server[] Registers the <> definitions set in `ingest/pipeline/definition.json`. endif::apm-server[] -*`--template`*:: -deprecated:[7.2] -Sets up the index template only. -It is recommended to use `--index-management` instead. - -*`--ilm-policy`*:: -deprecated:[7.2] -Sets up the index lifecycle management policy. -It is recommended to use `--index-management` instead. - {global-flags} *EXAMPLES* diff --git a/libbeat/tests/system/test_ilm.py b/libbeat/tests/system/test_ilm.py index 12c79fad61d..672f51327f6 100644 --- a/libbeat/tests/system/test_ilm.py +++ b/libbeat/tests/system/test_ilm.py @@ -191,23 +191,6 @@ def render_config(self, **kwargs): **kwargs ) - @unittest.skipUnless(INTEGRATION_TESTS, "integration test") - @pytest.mark.tag('integration') - def test_setup_ilm_policy_and_template(self): - """ - Test combination of ilm policy and template setup - """ - self.render_config() - - # NOTE: --template is deprecated for 8.0.0./ - exit_code = self.run_beat(logging_args=["-v", "-d", "*"], - extra_args=["setup", self.setupCmd, "--template"]) - - assert exit_code == 0 - self.idxmgmt.assert_ilm_template_loaded(self.alias_name, self.policy_name, self.alias_name) - self.idxmgmt.assert_alias_created(self.alias_name) - self.idxmgmt.assert_policy_created(self.policy_name) - @unittest.skipUnless(INTEGRATION_TESTS, "integration test") @pytest.mark.tag('integration') def test_setup_ilm_default(self): diff --git a/libbeat/tests/system/test_template.py b/libbeat/tests/system/test_template.py index cc80e284f4e..6a81a6bd036 100644 --- a/libbeat/tests/system/test_template.py +++ b/libbeat/tests/system/test_template.py @@ -181,7 +181,7 @@ def setUp(self): super(TestCommandSetupTemplate, self).setUp() # auto-derived default settings, if nothing else is set - self.setupCmd = "--template" + self.setupCmd = "--index-management" self.index_name = self.beat_name + "-9.9.9" self.custom_alias = self.beat_name + "_foo" self.policy_name = self.beat_name @@ -209,7 +209,7 @@ def test_setup(self): """ self.render_config() exit_code = self.run_beat(logging_args=["-v", "-d", "*"], - extra_args=["setup", self.setupCmd, "--ilm-policy"]) + extra_args=["setup", self.setupCmd]) assert exit_code == 0 self.idxmgmt.assert_ilm_template_loaded(self.index_name, self.policy_name, self.index_name) @@ -230,8 +230,6 @@ def test_setup_template_default(self): self.idxmgmt.assert_ilm_template_loaded(self.index_name, self.policy_name, self.index_name) self.idxmgmt.assert_index_template_index_pattern(self.index_name, [self.index_name + "-*"]) - # when running `setup --template` - # write_alias and rollover_policy related to ILM are also created self.idxmgmt.assert_alias_created(self.index_name) self.idxmgmt.assert_policy_created(self.policy_name) @@ -249,8 +247,6 @@ def test_setup_template_disabled(self): assert exit_code == 0 self.idxmgmt.assert_index_template_not_loaded(self.index_name) - # when running `setup --template` and `setup.template.enabled=false` - # write_alias and rollover_policy related to ILM are still created self.idxmgmt.assert_alias_created(self.index_name) self.idxmgmt.assert_policy_created(self.policy_name) diff --git a/metricbeat/tests/system/test_base.py b/metricbeat/tests/system/test_base.py index 5d7cf103929..43b548013e9 100644 --- a/metricbeat/tests/system/test_base.py +++ b/metricbeat/tests/system/test_base.py @@ -39,9 +39,9 @@ def test_start_stop(self): assert self.log_contains("metricbeat stopped") @unittest.skipUnless(INTEGRATION_TESTS, "integration test") - def test_template(self): + def test_index_management(self): """ - Test that the template can be loaded with `setup --template` + Test that the template can be loaded with `setup --index-management` """ es = Elasticsearch([self.get_elasticsearch_url()]) self.render_config_template( @@ -52,7 +52,7 @@ def test_template(self): }], elasticsearch={"host": self.get_elasticsearch_url()}, ) - exit_code = self.run_beat(extra_args=["setup", "--template", "-E", "setup.template.overwrite=true"]) + exit_code = self.run_beat(extra_args=["setup", "--index-management", "-E", "setup.template.overwrite=true"]) assert exit_code == 0 assert self.log_contains('Loaded index template') @@ -100,7 +100,7 @@ def test_migration(self): }], elasticsearch={"host": self.get_elasticsearch_url()}, ) - exit_code = self.run_beat(extra_args=["setup", "--template", + exit_code = self.run_beat(extra_args=["setup", "--index-management", "-E", "setup.template.overwrite=true", "-E", "migration.6_to_7.enabled=true"]) assert exit_code == 0