From 8fe6416ccc1ff33b7532d7a8978b36866c79a2cd Mon Sep 17 00:00:00 2001 From: jaymode Date: Tue, 10 Mar 2020 14:47:39 -0600 Subject: [PATCH 1/4] Deprecate the logstash enabled setting The setting, `xpack.logstash.enabled`, exists to enable or disable the logstash extensions found within x-pack. In practice, this setting had no effect on the functionality of the extension. Given this, the setting is now deprecated in preparation for removal. --- .../test/java/org/elasticsearch/xpack/CcrIntegTestCase.java | 1 - .../java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java | 1 - .../java/org/elasticsearch/xpack/core/XPackSettings.java | 2 +- .../xpack/ilm/IndexLifecycleInitialisationTests.java | 1 - .../xpack/slm/SnapshotLifecycleInitialisationTests.java | 1 - .../java/org/elasticsearch/xpack/logstash/Logstash.java | 6 +----- 6 files changed, 2 insertions(+), 10 deletions(-) diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java index 7181dd9b6c9a2..c349ea764101f 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java @@ -225,7 +225,6 @@ private NodeConfigurationSource createNodeConfigurationSource(final String leade builder.put(XPackSettings.MONITORING_ENABLED.getKey(), false); builder.put(XPackSettings.WATCHER_ENABLED.getKey(), false); builder.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false); - builder.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial"); // Let cluster state api return quickly in order to speed up auto follow tests: builder.put(CcrSettings.CCR_WAIT_FOR_METADATA_TIMEOUT.getKey(), TimeValue.timeValueMillis(100)); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java index cbfd078452368..9858362c811de 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java @@ -48,7 +48,6 @@ protected Settings nodeSettings() { builder.put(XPackSettings.MONITORING_ENABLED.getKey(), false); builder.put(XPackSettings.WATCHER_ENABLED.getKey(), false); builder.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false); - builder.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial"); // Let cluster state api return quickly in order to speed up auto follow tests: builder.put(CcrSettings.CCR_WAIT_FOR_METADATA_TIMEOUT.getKey(), TimeValue.timeValueMillis(100)); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java index 82e9f2553c3ed..029cdbf00e805 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java @@ -82,7 +82,7 @@ private XPackSettings() { /** Setting for enabling or disabling Logstash extensions. Defaults to true. */ public static final Setting LOGSTASH_ENABLED = Setting.boolSetting("xpack.logstash.enabled", true, - Setting.Property.NodeScope); + Setting.Property.NodeScope, Property.Deprecated); /** Setting for enabling or disabling Beats extensions. Defaults to true. */ public static final Setting BEATS_ENABLED = Setting.boolSetting("xpack.beats.enabled", true, diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java index 4f4c2913fb2a4..965c5beb5af04 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java @@ -100,7 +100,6 @@ protected Settings nodeSettings(int nodeOrdinal) { settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false); settings.put(XPackSettings.MONITORING_ENABLED.getKey(), false); settings.put(XPackSettings.GRAPH_ENABLED.getKey(), false); - settings.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); settings.put(LifecycleSettings.LIFECYCLE_POLL_INTERVAL, "1s"); // This is necessary to prevent ILM and SLM installing a lifecycle policy, these tests assume a blank slate diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java index 180ff53cf5b97..58f0b632e1321 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java @@ -50,7 +50,6 @@ protected Settings nodeSettings() { settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false); settings.put(XPackSettings.MONITORING_ENABLED.getKey(), false); settings.put(XPackSettings.GRAPH_ENABLED.getKey(), false); - settings.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); settings.put(Environment.PATH_REPO_SETTING.getKey(), repositoryLocation); settings.put(XPackSettings.SNAPSHOT_LIFECYCLE_ENABLED.getKey(), true); diff --git a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java index 177135974fb6c..d9505d612f6de 100644 --- a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java +++ b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java @@ -14,7 +14,6 @@ import org.elasticsearch.indices.SystemIndexDescriptor; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.SystemIndexPlugin; -import org.elasticsearch.xpack.core.XPackSettings; import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction; import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction; import org.elasticsearch.xpack.core.template.TemplateUtils; @@ -37,10 +36,7 @@ public class Logstash extends Plugin implements SystemIndexPlugin { private static final String OLD_LOGSTASH_INDEX_NAME = "logstash-index-template"; private static final String TEMPLATE_VERSION_VARIABLE = "logstash.template.version"; - private final boolean enabled; - - public Logstash(Settings settings) { - this.enabled = XPackSettings.LOGSTASH_ENABLED.get(settings); + public Logstash() { } @Override From 2fa4e1f18a4c21e74f752381b0e905b986e86a88 Mon Sep 17 00:00:00 2001 From: jaymode Date: Tue, 10 Mar 2020 15:14:21 -0600 Subject: [PATCH 2/4] account for warning in test --- .../xpack/logstash/LogstashInfoTransportActionTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java b/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java index 42115fbf74c07..6e12612dd2728 100644 --- a/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java +++ b/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java @@ -8,11 +8,13 @@ import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.core.XPackFeatureSet; +import org.elasticsearch.xpack.core.XPackSettings; import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse; import org.elasticsearch.xpack.core.logstash.LogstashFeatureSetUsage; @@ -41,6 +43,8 @@ public void testEnabledSetting() throws Exception { usage.writeTo(out); XPackFeatureSet.Usage serializedUsage = new LogstashFeatureSetUsage(out.bytes().streamInput()); assertThat(serializedUsage.enabled(), is(enabled)); + + assertSettingDeprecationsAndWarnings(new Setting[] { XPackSettings.LOGSTASH_ENABLED }); } public void testEnabledDefault() throws Exception { From f707d8ba39d8f89cf32166799310e3b7311116e7 Mon Sep 17 00:00:00 2001 From: jaymode Date: Tue, 10 Mar 2020 15:32:40 -0600 Subject: [PATCH 3/4] rawtypes --- .../xpack/logstash/LogstashInfoTransportActionTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java b/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java index 6e12612dd2728..096cdaab804bd 100644 --- a/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java +++ b/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashInfoTransportActionTests.java @@ -44,7 +44,7 @@ public void testEnabledSetting() throws Exception { XPackFeatureSet.Usage serializedUsage = new LogstashFeatureSetUsage(out.bytes().streamInput()); assertThat(serializedUsage.enabled(), is(enabled)); - assertSettingDeprecationsAndWarnings(new Setting[] { XPackSettings.LOGSTASH_ENABLED }); + assertSettingDeprecationsAndWarnings(new Setting[] { XPackSettings.LOGSTASH_ENABLED }); } public void testEnabledDefault() throws Exception { From 132918d513cb04f375eacfcf5c0608cc84ce6192 Mon Sep 17 00:00:00 2001 From: jaymode Date: Wed, 11 Mar 2020 08:58:40 -0600 Subject: [PATCH 4/4] format --- .../main/java/org/elasticsearch/xpack/logstash/Logstash.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java index bec778f0506d4..3d22402e89779 100644 --- a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java +++ b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java @@ -36,8 +36,7 @@ public class Logstash extends Plugin implements SystemIndexPlugin { private static final String OLD_LOGSTASH_INDEX_NAME = "logstash-index-template"; private static final String TEMPLATE_VERSION_VARIABLE = "logstash.template.version"; - public Logstash() { - } + public Logstash() {} @Override public List> getActions() {