Skip to content

Commit

Permalink
Fix missing nodes from Node Listing page when using Metricbeat Elasti…
Browse files Browse the repository at this point in the history
…csearch module with xpack.enabled: true (#10639) (#10671)

* Add source_node object to node_stats documents

* Adding CHANGELOG entry

(cherry picked from commit 6ddaae6)
  • Loading branch information
ycombinator committed Feb 12, 2019
1 parent d6d117a commit b043569
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
12 changes: 12 additions & 0 deletions metricbeat/module/elasticsearch/node_stats/data_xpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b043569

Please sign in to comment.