From ae4ccb95195ad52d250aebad257be88463364225 Mon Sep 17 00:00:00 2001 From: Daniel Mitterdorfer Date: Tue, 26 Sep 2023 13:24:08 +0200 Subject: [PATCH] [Profiling] Allow to customize the ILM policy With this commit we reference the component template `profiling-ilm@custom` in all composable index templates that define indices / data streams managed by ILM. This allows users to override the built-in ILM policy and define e.g. a shorter retention period. --- .../resources/profiling/index-template/profiling-events.json | 4 +++- .../profiling/index-template/profiling-executables.json | 4 +++- .../resources/profiling/index-template/profiling-hosts.json | 4 +++- .../resources/profiling/index-template/profiling-metrics.json | 4 +++- .../profiling/index-template/profiling-stackframes.json | 4 +++- .../profiling/index-template/profiling-stacktraces.json | 4 +++- .../profiling/index-template/profiling-symbols-global.json | 4 +++- .../xpack/profiling/ProfilingIndexTemplateRegistry.java | 3 ++- 8 files changed, 23 insertions(+), 8 deletions(-) diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-events.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-events.json index 2ade70d6a0a81..795e2d318ddb9 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-events.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-events.json @@ -7,8 +7,10 @@ }, "composed_of": [ "profiling-events", - "profiling-ilm" + "profiling-ilm", + "profiling-ilm@custom" ], + "ignore_missing_component_templates": ["profiling-ilm@custom"], "priority": 100, "_meta": { "description": "Index template for profiling-events" diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-executables.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-executables.json index 8642d23cd446c..41df385022fdf 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-executables.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-executables.json @@ -5,8 +5,10 @@ "composed_of": [ "profiling-executables", "profiling-ilm", - "profiling-hot-tier" + "profiling-hot-tier", + "profiling-ilm@custom" ], + "ignore_missing_component_templates": ["profiling-ilm@custom"], "priority": 100, "_meta": { "description": "Index template for .profiling-executables" diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-hosts.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-hosts.json index ca8409dab4129..6189c86bb2999 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-hosts.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-hosts.json @@ -5,8 +5,10 @@ "data_stream": {}, "composed_of": [ "profiling-hosts", - "profiling-ilm" + "profiling-ilm", + "profiling-ilm@custom" ], + "ignore_missing_component_templates": ["profiling-ilm@custom"], "priority": 100, "_meta": { "description": "Template for profiling-hosts" diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-metrics.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-metrics.json index 080bd7d5bcef4..b9154bfa54334 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-metrics.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-metrics.json @@ -5,8 +5,10 @@ "data_stream": {}, "composed_of": [ "profiling-metrics", - "profiling-ilm" + "profiling-ilm", + "profiling-ilm@custom" ], + "ignore_missing_component_templates": ["profiling-ilm@custom"], "priority": 100, "_meta": { "description": "Template for profiling-metrics" diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stackframes.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stackframes.json index 76825888dbae5..eed570de0a608 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stackframes.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stackframes.json @@ -5,8 +5,10 @@ "composed_of": [ "profiling-stackframes", "profiling-ilm", - "profiling-hot-tier" + "profiling-hot-tier", + "profiling-ilm@custom" ], + "ignore_missing_component_templates": ["profiling-ilm@custom"], "priority": 100, "_meta": { "description": "Index template for .profiling-stackframes" diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stacktraces.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stacktraces.json index eef41ee8384ad..3797b87b17f10 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stacktraces.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-stacktraces.json @@ -5,8 +5,10 @@ "composed_of": [ "profiling-stacktraces", "profiling-ilm", - "profiling-hot-tier" + "profiling-hot-tier", + "profiling-ilm@custom" ], + "ignore_missing_component_templates": ["profiling-ilm@custom"], "priority": 100, "_meta": { "description": "Index template for .profiling-stacktraces" diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-symbols-global.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-symbols-global.json index 5ac22569f9adc..cd6c597f19689 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-symbols-global.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/index-template/profiling-symbols-global.json @@ -5,8 +5,10 @@ "composed_of": [ "profiling-symbols", "profiling-ilm", - "profiling-hot-tier" + "profiling-hot-tier", + "profiling-ilm@custom" ], + "ignore_missing_component_templates": ["profiling-ilm@custom"], "template": { "settings": { "index": { diff --git a/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/ProfilingIndexTemplateRegistry.java b/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/ProfilingIndexTemplateRegistry.java index 1d19210c31692..8561ccc8f50a6 100644 --- a/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/ProfilingIndexTemplateRegistry.java +++ b/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/ProfilingIndexTemplateRegistry.java @@ -41,7 +41,8 @@ public class ProfilingIndexTemplateRegistry extends IndexTemplateRegistry { // history (please add a comment why you increased the version here) // version 1: initial // version 2: Added 'profiling.host.machine' keyword mapping to profiling-hosts - public static final int INDEX_TEMPLATE_VERSION = 2; + // version 3: Add optional component template profiling-ilm@custom to all ILM-managed index templates + public static final int INDEX_TEMPLATE_VERSION = 3; // history for individual indices / index templates. Only bump these for breaking changes that require to create a new index public static final int PROFILING_EVENTS_VERSION = 1;