Skip to content

Commit 6dfdacd

Browse files
authored
Remove watcher history clean up from monitoring (#67154)
Monitoring should not clean up watcher history - indices are managed by ILM policy now. It was deprecated in 7.x, removing it now in 8
1 parent d6e6f75 commit 6dfdacd

File tree

4 files changed

+2
-59
lines changed

4 files changed

+2
-59
lines changed

docs/reference/settings/notification-settings.asciidoc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,6 @@ Specifies the path to a file that contains a key for encrypting sensitive data.
4242
If `xpack.watcher.encrypt_sensitive_data` is set to `true`, this setting is
4343
required. For more information, see <<encrypting-data>>.
4444

45-
[[xpack-watcher-history-cleaner-service]]
46-
// tag::watcher-history-cleaner-service-tag[]
47-
`xpack.watcher.history.cleaner_service.enabled` {ess-icon}::
48-
(<<dynamic-cluster-setting,Dynamic>>)
49-
added:[6.3.0,Default changed to `true`.]
50-
deprecated:[7.0.0,Watcher history indices are now managed by the `watch-history-ilm-policy` ILM policy]
51-
+
52-
Set to `true` (default) to enable the cleaner service. The cleaner service
53-
removes previous versions of {watcher} indices (for example,
54-
`.watcher-history*`) when it determines that they are old. The duration of
55-
{watcher} indices is determined by the `xpack.monitoring.history.duration`
56-
setting, which defaults to 7 days. For more information about that setting,
57-
see <<monitoring-settings>>.
58-
// end::watcher-history-cleaner-service-tag[]
59-
6045
`xpack.http.proxy.host`::
6146
(<<static-cluster-setting,Static>>)
6247
Specifies the address of the proxy server to use to connect to HTTP services.

x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@
7373

7474
public class Monitoring extends Plugin implements ActionPlugin, ReloadablePlugin {
7575

76-
/**
77-
* The ability to automatically cleanup ".watcher_history*" indices while also cleaning up Monitoring indices.
78-
*/
79-
@Deprecated
80-
public static final Setting<Boolean> CLEAN_WATCHER_HISTORY = boolSetting("xpack.watcher.history.cleaner_service.enabled",
81-
true, Setting.Property.Dynamic, Setting.Property.NodeScope, Setting.Property.Deprecated);
82-
8376
public static final Setting<Boolean> MIGRATION_DECOMMISSION_ALERTS = boolSetting("xpack.monitoring.migration.decommission_alerts",
8477
false, Setting.Property.Dynamic, Setting.Property.NodeScope);
8578

@@ -154,7 +147,6 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
154147
public List<Setting<?>> getSettings() {
155148
List<Setting<?>> settings = new ArrayList<>();
156149
settings.add(MonitoringField.HISTORY_DURATION);
157-
settings.add(CLEAN_WATCHER_HISTORY);
158150
settings.add(MonitoringService.ENABLED);
159151
settings.add(MonitoringService.ELASTICSEARCH_COLLECTION_ENABLED);
160152
settings.add(MonitoringService.INTERVAL);

x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.loadPipeline;
8787
import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.pipelineName;
8888
import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.templateName;
89-
import static org.elasticsearch.xpack.monitoring.Monitoring.CLEAN_WATCHER_HISTORY;
9089

9190
public class LocalExporter extends Exporter implements ClusterStateListener, CleanerService.Listener, LicenseStateListener {
9291

@@ -641,11 +640,9 @@ public void onCleanUpIndices(TimeValue retention) {
641640
if (clusterState != null) {
642641
final long expirationTimeMillis = expiration.toInstant().toEpochMilli();
643642
final long currentTimeMillis = System.currentTimeMillis();
644-
final boolean cleanUpWatcherHistory = clusterService.getClusterSettings().get(CLEAN_WATCHER_HISTORY);
645643

646-
// list of index patterns that we clean up; watcher history can be included
647-
final String[] indexPatterns =
648-
cleanUpWatcherHistory ? new String[] { ".monitoring-*", ".watcher-history*" } : new String[] { ".monitoring-*" };
644+
// list of index patterns that we clean up
645+
final String[] indexPatterns = new String[] { ".monitoring-*" };
649646

650647
// Get the names of the current monitoring indices
651648
final Set<String> currents = MonitoredSystem.allSystems()

x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/local/LocalIndicesCleanerTests.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.elasticsearch.plugins.Plugin;
1414
import org.elasticsearch.test.InternalSettingsPlugin;
1515
import org.elasticsearch.xpack.monitoring.cleaner.AbstractIndicesCleanerTestCase;
16-
import org.elasticsearch.xpack.monitoring.cleaner.CleanerService;
1716
import org.elasticsearch.xpack.monitoring.exporter.local.LocalExporter;
1817

1918
import java.time.ZonedDateTime;
@@ -24,8 +23,6 @@
2423

2524
public class LocalIndicesCleanerTests extends AbstractIndicesCleanerTestCase {
2625

27-
private final boolean cleanUpWatcherHistory = randomBoolean();
28-
2926
@Override
3027
protected Collection<Class<? extends Plugin>> nodePlugins() {
3128
return CollectionUtils.appendToCopy(super.nodePlugins(), InternalSettingsPlugin.class);
@@ -36,7 +33,6 @@ protected Settings nodeSettings(int nodeOrdinal) {
3633
return Settings.builder()
3734
.put(super.nodeSettings(nodeOrdinal))
3835
.put("xpack.monitoring.exporters._local.type", LocalExporter.TYPE)
39-
.put("xpack.watcher.history.cleaner_service.enabled", cleanUpWatcherHistory)
4036
.build();
4137
}
4238

@@ -59,31 +55,4 @@ protected void assertIndicesCount(int count) throws Exception {
5955
assertThat(getSettingsResponse.getIndexToSettings().size(), equalTo(count));
6056
});
6157
}
62-
63-
public void testHandlesWatcherHistory() throws Exception {
64-
internalCluster().startNode();
65-
66-
// Will be deleted (if we delete them)
67-
createWatcherHistoryIndex(now().minusDays(7));
68-
createWatcherHistoryIndex(now().minusDays(10), "6");
69-
createWatcherHistoryIndex(now().minusDays(14), "3");
70-
createWatcherHistoryIndex(now().minusDays(30), "2");
71-
createWatcherHistoryIndex(now().minusYears(1), "1");
72-
createWatcherHistoryIndex(now().minusDays(10), String.valueOf(Integer.MAX_VALUE));
73-
74-
// Won't be deleted
75-
createWatcherHistoryIndex(now());
76-
77-
assertIndicesCount(7);
78-
79-
CleanerService.Listener listener = getListener();
80-
listener.onCleanUpIndices(days(3));
81-
82-
if (cleanUpWatcherHistory) {
83-
assertIndicesCount(1);
84-
} else {
85-
assertIndicesCount(7);
86-
}
87-
}
88-
8958
}

0 commit comments

Comments
 (0)