Skip to content

Commit

Permalink
Index cluster_uuid in elasticsearch/shard metricset (#8770)
Browse files Browse the repository at this point in the history
This PR teaches the `elasticsearch/shard` metricset to index the Elasticsearch `cluster_uuid` as the module-level `cluster.id` field.
  • Loading branch information
ycombinator authored Nov 1, 2018
1 parent bb93d05 commit 2a5fbbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions metricbeat/module/elasticsearch/shard/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"elasticsearch": {
"cluster": {
"id": "91RpCx2xSQ21pVPTZfDK0Q",
"name": "elasticsearch",
"state": {
"id": "MBE4XrQOSf6ScXRTuCO1Pw"
Expand All @@ -20,6 +21,9 @@
"shard": {
"number": 0,
"primary": true,
"relocating_node": {
"name": null
},
"state": "STARTED"
}
},
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/module/elasticsearch/shard/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
)

type stateStruct struct {
ClusterID string `json:"cluster_uuid"`
ClusterName string `json:"cluster_name"`
StateID string `json:"state_uuid"`
MasterNode string `json:"master_node"`
Expand Down Expand Up @@ -73,6 +74,7 @@ func eventsMapping(r mb.ReporterV2, content []byte) error {

event.ModuleFields = common.MapStr{}
event.ModuleFields.Put("cluster.state.id", stateData.StateID)
event.ModuleFields.Put("cluster.id", stateData.ClusterID)
event.ModuleFields.Put("cluster.name", stateData.ClusterName)

fields, err := schema.Apply(shard)
Expand Down

0 comments on commit 2a5fbbc

Please sign in to comment.