From 022bae082d1535a973c356b20552a4bc2ef91ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Fri, 7 Feb 2025 15:52:31 +0100 Subject: [PATCH 1/2] Use LogsDB for profiling events to reduce storage footprint --- .../component-template/profiling-events.json | 20 +++++++++++++------ .../ProfilingIndexTemplateRegistry.java | 6 ++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/x-pack/plugin/core/template-resources/src/main/resources/profiling/component-template/profiling-events.json b/x-pack/plugin/core/template-resources/src/main/resources/profiling/component-template/profiling-events.json index c7424571dd678..11fa31d726ed5 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/profiling/component-template/profiling-events.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/profiling/component-template/profiling-events.json @@ -1,6 +1,7 @@ { "template": { "settings": { + "mode": "logsdb", "index": { "number_of_shards": 4, "auto_expand_replicas": "0-1", @@ -11,15 +12,22 @@ "profiling.project.id", "k8s.namespace.name", "orchestrator.resource.name", + "service.name", "host.name", "container.name", - "process.thread.name" + "process.thread.name", + "@timestamp" + ], + "order": [ + "asc", + "asc", + "asc", + "asc", + "asc", + "asc", + "asc", + "desc" ] - }, - "mapping": { - "source": { - "mode": "synthetic" - } } }, "codec": "best_compression" diff --git a/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java b/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java index 71e8dcbff4ee6..2bddd3a8eb875 100644 --- a/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java +++ b/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java @@ -54,10 +54,12 @@ public class ProfilingIndexTemplateRegistry extends IndexTemplateRegistry { // version 11: Added 'profiling.agent.protocol' keyword mapping to profiling-hosts // version 12: Added 'profiling.agent.env_https_proxy' keyword mapping to profiling-hosts // version 13: Added 'container.id' keyword mapping to profiling-events - public static final int INDEX_TEMPLATE_VERSION = 14; + // version 14: Stop using using _source.mode attribute in index templates + // version 15: Use LogsDB mode for profiling-events-* (~20% smaller storage footprint) + public static final int INDEX_TEMPLATE_VERSION = 15; // 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 = 5; + public static final int PROFILING_EVENTS_VERSION = 6; public static final int PROFILING_EXECUTABLES_VERSION = 1; public static final int PROFILING_METRICS_VERSION = 2; public static final int PROFILING_HOSTS_VERSION = 2; From a8dcff1eff70d5e1a0bcdaa3ccbe9c0d373d19af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Mon, 10 Feb 2025 12:03:45 +0100 Subject: [PATCH 2/2] Amend number for storage footprint --- .../profiling/persistence/ProfilingIndexTemplateRegistry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java b/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java index 2bddd3a8eb875..e9e541d44fb59 100644 --- a/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java +++ b/x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/persistence/ProfilingIndexTemplateRegistry.java @@ -55,7 +55,7 @@ public class ProfilingIndexTemplateRegistry extends IndexTemplateRegistry { // version 12: Added 'profiling.agent.env_https_proxy' keyword mapping to profiling-hosts // version 13: Added 'container.id' keyword mapping to profiling-events // version 14: Stop using using _source.mode attribute in index templates - // version 15: Use LogsDB mode for profiling-events-* (~20% smaller storage footprint) + // version 15: Use LogsDB mode for profiling-events-* (~30% smaller storage footprint) public static final int INDEX_TEMPLATE_VERSION = 15; // history for individual indices / index templates. Only bump these for breaking changes that require to create a new index