diff --git a/docs/reference/migration/migrate_8_0.asciidoc b/docs/reference/migration/migrate_8_0.asciidoc index e166a6eb83740..dad7b225b936a 100644 --- a/docs/reference/migration/migrate_8_0.asciidoc +++ b/docs/reference/migration/migrate_8_0.asciidoc @@ -25,7 +25,6 @@ coming[8.0.0] * <> * <> * <> -* <> * <> * <> * <> @@ -128,7 +127,6 @@ include::migrate_8_0/indices.asciidoc[] include::migrate_8_0/ingest.asciidoc[] include::migrate_8_0/java.asciidoc[] include::migrate_8_0/mappings.asciidoc[] -include::migrate_8_0/monitoring.asciidoc[] include::migrate_8_0/network.asciidoc[] include::migrate_8_0/node.asciidoc[] include::migrate_8_0/packaging.asciidoc[] diff --git a/docs/reference/migration/migrate_8_0/monitoring.asciidoc b/docs/reference/migration/migrate_8_0/monitoring.asciidoc deleted file mode 100644 index cdedfe29982c5..0000000000000 --- a/docs/reference/migration/migrate_8_0/monitoring.asciidoc +++ /dev/null @@ -1,47 +0,0 @@ -[discrete] -[[breaking_80_monitoring_changes]] -=== Monitoring changes - -//NOTE: The notable-breaking-changes tagged regions are re-used in the -//Installation and Upgrade Guide - -//tag::notable-breaking-changes[] -.The `use_ingest` setting on Monitoring exporter configurations has been removed. -[%collapsible] -==== -*Details* + -The `xpack.monitoring.exporters.*.use_ingest` property was deprecated in 7.16.0 and -has been removed. This parameter controlled the creation of pipelines for monitoring -indices that previously had no function. - -*Impact* + -Discontinue the use of the `xpack.monitoring.exporters.*.use_ingest` setting. -==== - -.The `index.pipeline.master_timeout` setting on Monitoring HTTP exporter configurations has been removed. -[%collapsible] -==== -*Details* + -The `xpack.monitoring.exporters.*.index.pipeline.master_timeout` property was -deprecated in 7.16.0. This parameter set the timeout when waiting for the remote -Monitoring cluster to create pipelines. Those pipelines for monitoring indices previously -had no function and are now removed in 8.0.0. - -*Impact* + -Discontinue the use of the `xpack.monitoring.exporters.*.index.pipeline.master_timeout` setting. -==== - -.The `index.template.create_legacy_templates` setting on Monitoring HTTP exporter configurations has been removed. -[%collapsible] -==== -*Details* + -The `xpack.monitoring.exporters.*.index.template.create_legacy_templates` property was -deprecated in 7.16.0. This parameter instructed the exporter to install the previous version -of monitoring templates on the monitoring cluster. These older templates were meant to assist -in transitioning to the current monitoring data format. They are currently empty and are no -longer of any use. - -*Impact* + -Discontinue the use of the `xpack.monitoring.exporters.*.index.template.create_legacy_templates` setting. -==== -//end::notable-breaking-changes[] diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringDeprecatedSettings.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/MonitoringDeprecatedSettings.java similarity index 97% rename from x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringDeprecatedSettings.java rename to x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/MonitoringDeprecatedSettings.java index 3b6a5370a5151..1a467a404cf01 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringDeprecatedSettings.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/MonitoringDeprecatedSettings.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.monitoring; +package org.elasticsearch.xpack.core.monitoring; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java index e850929a5b97d..2593f736bf39f 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java @@ -45,7 +45,10 @@ private DeprecationChecks() { static List> NODE_SETTINGS_CHECKS = List.of( NodeDeprecationChecks::checkSharedDataPathSetting, NodeDeprecationChecks::checkReservedPrefixedRealmNames, - NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting + NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting, + NodeDeprecationChecks::checkExporterUseIngestPipelineSettings, + NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting, + NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting ); static List> INDEX_SETTINGS_CHECKS = List.of( diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java index 6d06a61908154..d9fede7274447 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java @@ -13,10 +13,12 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; +import org.elasticsearch.xpack.core.monitoring.MonitoringDeprecatedSettings; import org.elasticsearch.xpack.core.security.authc.RealmConfig; import org.elasticsearch.xpack.core.security.authc.RealmSettings; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -93,4 +95,48 @@ static DeprecationIssue checkSingleDataNodeWatermarkSetting(final Settings setti return null; } + + private static DeprecationIssue deprecatedAffixSetting(Setting.AffixSetting deprecatedAffixSetting, String detailPattern, + String url, DeprecationIssue.Level warningLevel, Settings settings) { + List> deprecatedConcreteSettings = deprecatedAffixSetting.getAllConcreteSettings(settings) + .sorted(Comparator.comparing(Setting::getKey)).collect(Collectors.toList()); + + if (deprecatedConcreteSettings.isEmpty()) { + return null; + } + + final String concatSettingNames = deprecatedConcreteSettings.stream().map(Setting::getKey).collect(Collectors.joining(",")); + final String message = String.format( + Locale.ROOT, + "The [%s] settings are deprecated and will be removed after 8.0", + concatSettingNames + ); + final String details = String.format(Locale.ROOT, detailPattern, concatSettingNames); + + return new DeprecationIssue(warningLevel, message, url, details, false, null); + } + + static DeprecationIssue checkExporterUseIngestPipelineSettings(final Settings settings, final PluginsAndModules pluginsAndModules) { + return deprecatedAffixSetting(MonitoringDeprecatedSettings.USE_INGEST_PIPELINE_SETTING, + "Remove the following settings from elasticsearch.yml: [%s]", + "https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting", + DeprecationIssue.Level.WARNING, + settings); + } + + static DeprecationIssue checkExporterPipelineMasterTimeoutSetting(final Settings settings, final PluginsAndModules pluginsAndModules) { + return deprecatedAffixSetting(MonitoringDeprecatedSettings.PIPELINE_CHECK_TIMEOUT_SETTING, + "Remove the following settings from elasticsearch.yml: [%s]", + "https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting", + DeprecationIssue.Level.WARNING, + settings); + } + + static DeprecationIssue checkExporterCreateLegacyTemplateSetting(final Settings settings, final PluginsAndModules pluginsAndModules) { + return deprecatedAffixSetting(MonitoringDeprecatedSettings.TEMPLATE_CREATE_LEGACY_VERSIONS_SETTING, + "Remove the following settings from elasticsearch.yml: [%s]", + "https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting", + DeprecationIssue.Level.WARNING, + settings); + } } diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java index 83f2689abf177..42088a0ba89c2 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java @@ -11,6 +11,7 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.env.Environment; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; @@ -138,4 +139,57 @@ public void testSingleDataNodeWatermarkSetting() { " Discontinue use of this setting.", false, null))); } + + public void testExporterUseIngestPipelineSettings() { + Settings settings = Settings.builder() + .put("xpack.monitoring.exporters.test.use_ingest", true) + .build(); + + List issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null)); + + final String expectedUrl = + "https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting"; + assertThat(issues, hasItem( + new DeprecationIssue(DeprecationIssue.Level.WARNING, + "The [xpack.monitoring.exporters.test.use_ingest] settings are deprecated and will be removed after 8.0", + expectedUrl, + "Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.use_ingest]", + false, null))); + } + + public void testExporterPipelineMasterTimeoutSetting() { + Settings settings = Settings.builder() + .put("xpack.monitoring.exporters.test.index.pipeline.master_timeout", TimeValue.timeValueSeconds(10)) + .build(); + + List issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null)); + + final String expectedUrl = + "https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting"; + assertThat(issues, hasItem( + new DeprecationIssue(DeprecationIssue.Level.WARNING, + "The [xpack.monitoring.exporters.test.index.pipeline.master_timeout] settings are deprecated and will be removed after 8.0", + expectedUrl, + "Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.index.pipeline.master_timeout]", + false, null))); + } + + public void testExporterCreateLegacyTemplateSetting() { + Settings settings = Settings.builder() + .put("xpack.monitoring.exporters.test.index.template.create_legacy_templates", true) + .build(); + + List issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null)); + + final String expectedUrl = + "https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting"; + assertThat(issues, hasItem( + new DeprecationIssue(DeprecationIssue.Level.WARNING, + "The [xpack.monitoring.exporters.test.index.template.create_legacy_templates] settings are deprecated and will be " + + "removed after 8.0", + expectedUrl, + "Remove the following settings from elasticsearch.yml: " + + "[xpack.monitoring.exporters.test.index.template.create_legacy_templates]", + false, null))); + } } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java index 96f25c319975a..14ece00b640dc 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java @@ -37,6 +37,7 @@ import org.elasticsearch.xpack.core.XPackPlugin; import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction; import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction; +import org.elasticsearch.xpack.core.monitoring.MonitoringDeprecatedSettings; import org.elasticsearch.xpack.core.monitoring.MonitoringField; import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction; import org.elasticsearch.xpack.core.monitoring.action.MonitoringMigrateAlertsAction;