diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 636ff9a605a..8d3a4998af9 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -203,6 +203,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fixed data type for isr field in `kafka/partition` metricset {pull}10307[10307] - Fixed data types for various hosts fields in `mongodb/replstatus` metricset {pull}10307[10307] - Added function to close sql database connection. {pull}10355[10355] +- Fix issue with `elasticsearch/node_stats` metricset (x-pack) not indexing `source_node` field. {pull}10639[10639] *Packetbeat* diff --git a/metricbeat/module/elasticsearch/node_stats/data_xpack.go b/metricbeat/module/elasticsearch/node_stats/data_xpack.go index e59caa97852..69f9bf9ed87 100644 --- a/metricbeat/module/elasticsearch/node_stats/data_xpack.go +++ b/metricbeat/module/elasticsearch/node_stats/data_xpack.go @@ -35,6 +35,8 @@ import ( var ( schemaXpack = s.Schema{ + "name": c.Str("name"), + "transport_address": c.Str("transport_address"), "indices": c.Dict("indices", s.Schema{ "docs": c.Dict("docs", s.Schema{ "count": c.Int("count"), @@ -197,12 +199,22 @@ func eventsMappingXPack(r mb.ReporterV2, m *MetricSet, info elasticsearch.Info, nodeData["node_master"] = isMaster nodeData["node_id"] = nodeID + // Build source_node object + sourceNode := common.MapStr{ + "uuid": nodeID, + "name": nodeData["name"], + "transport_address": nodeData["transport_address"], + } + nodeData.Delete("name") + nodeData.Delete("transport_address") + event.RootFields = common.MapStr{ "timestamp": time.Now(), "cluster_uuid": info.ClusterID, "interval_ms": m.Module().Config().Period.Nanoseconds() / 1000 / 1000, "type": "node_stats", "node_stats": nodeData, + "source_node": sourceNode, } event.Index = elastic.MakeXPackMonitoringIndexName(elastic.Elasticsearch)