From 6d9d12d0e9b4be947108ac2ee17a86fe33030ae1 Mon Sep 17 00:00:00 2001 From: Kevin Lacabane Date: Fri, 24 Nov 2023 22:33:31 +0700 Subject: [PATCH] [kibana] pass unique `service.address` value (#37178) * unique service.address * fix stats metricset --- metricbeat/module/kibana/cluster_actions/data.go | 2 +- metricbeat/module/kibana/cluster_rules/data.go | 2 +- metricbeat/module/kibana/node_actions/data.go | 2 +- metricbeat/module/kibana/node_rules/data.go | 2 +- metricbeat/module/kibana/stats/data.go | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/metricbeat/module/kibana/cluster_actions/data.go b/metricbeat/module/kibana/cluster_actions/data.go index 182d7325a226..0cbb839e7517 100644 --- a/metricbeat/module/kibana/cluster_actions/data.go +++ b/metricbeat/module/kibana/cluster_actions/data.go @@ -90,9 +90,9 @@ func eventMapping(r mb.ReporterV2, content []byte, isXpack bool) error { RootFields: mapstr.M{ "service.id": serviceId, "service.version": version, - "service.address": serviceAddress, }, MetricSetFields: actionsFields, + Host: fmt.Sprintf("%v", serviceAddress), } // xpack.enabled in config using standalone metricbeat writes to `.monitoring` instead of `metricbeat-*` diff --git a/metricbeat/module/kibana/cluster_rules/data.go b/metricbeat/module/kibana/cluster_rules/data.go index 85b8093d5629..5cc159d6546f 100644 --- a/metricbeat/module/kibana/cluster_rules/data.go +++ b/metricbeat/module/kibana/cluster_rules/data.go @@ -90,9 +90,9 @@ func eventMapping(r mb.ReporterV2, content []byte, isXpack bool) error { RootFields: mapstr.M{ "service.id": serviceId, "service.version": version, - "service.address": serviceAddress, }, MetricSetFields: rulesFields, + Host: fmt.Sprintf("%v", serviceAddress), } // xpack.enabled in config using standalone metricbeat writes to `.monitoring` instead of `metricbeat-*` diff --git a/metricbeat/module/kibana/node_actions/data.go b/metricbeat/module/kibana/node_actions/data.go index ead19bb20528..4423288d952c 100644 --- a/metricbeat/module/kibana/node_actions/data.go +++ b/metricbeat/module/kibana/node_actions/data.go @@ -86,9 +86,9 @@ func eventMapping(r mb.ReporterV2, content []byte, isXpack bool) error { RootFields: mapstr.M{ "service.id": serviceId, "service.version": version, - "service.address": serviceAddress, }, MetricSetFields: actionsFields, + Host: fmt.Sprintf("%v", serviceAddress), } // xpack.enabled in config using standalone metricbeat writes to `.monitoring` instead of `metricbeat-*` diff --git a/metricbeat/module/kibana/node_rules/data.go b/metricbeat/module/kibana/node_rules/data.go index 6ded4d3bf392..2aa889cc3ed7 100644 --- a/metricbeat/module/kibana/node_rules/data.go +++ b/metricbeat/module/kibana/node_rules/data.go @@ -86,9 +86,9 @@ func eventMapping(r mb.ReporterV2, content []byte, isXpack bool) error { RootFields: mapstr.M{ "service.id": serviceId, "service.version": version, - "service.address": serviceAddress, }, MetricSetFields: rulesFields, + Host: fmt.Sprintf("%v", serviceAddress), } // xpack.enabled in config using standalone metricbeat writes to `.monitoring` instead of `metricbeat-*` diff --git a/metricbeat/module/kibana/stats/data.go b/metricbeat/module/kibana/stats/data.go index 1675772ae050..2b0ca12ef207 100644 --- a/metricbeat/module/kibana/stats/data.go +++ b/metricbeat/module/kibana/stats/data.go @@ -158,6 +158,7 @@ func eventMapping(r mb.ReporterV2, content []byte, isXpack bool) error { return event.Error } _, _ = event.RootFields.Put("service.address", serviceAddress) + event.Host = fmt.Sprintf("%v", serviceAddress) // Set process PID process, ok := data["process"].(map[string]interface{})