Skip to content

Commit

Permalink
[Elastic Agent] Add stream.* to metrics and logs collected (elastic#1…
Browse files Browse the repository at this point in the history
…8261)

* [Elastic Agent] Add stream.* to metrics and logs collected

This PR ensure that the stream.type, stream.dataset and stream.namespace
are added to each logs or metrics collected by the Agent.

Fixes: elastic#18203
(cherry picked from commit 7b87db5)
  • Loading branch information
ph committed May 5, 2020
1 parent bb4368d commit 43669f0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- Use default output by default {pull}18091[18091]
- Fix panic and flaky tests for the Agent. {pull}18135[18135]
- Fix default configuration after enroll {pull}18232[18232]
- Fix make sure the collected logs or metrics include streams information. {pull}18261[18261]

==== New features

Expand Down
24 changes: 24 additions & 0 deletions x-pack/elastic-agent/pkg/agent/operation/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ func (o *Operator) getMonitoringFilebeatConfig(output interface{}) (map[string]i
"type": "log",
"paths": paths,
"index": "logs-agent-default",
"processors": []map[string]interface{}{
map[string]interface{}{
"add_fields": map[string]interface{}{
"target": "stream",
"fields": map[string]interface{}{
"type": "logs",
"dataset": "agent",
"namespace": "default",
},
},
},
},
},
},
},
Expand Down Expand Up @@ -199,6 +211,18 @@ func (o *Operator) getMonitoringMetricbeatConfig(output interface{}) (map[string
"period": "10s",
"hosts": hosts,
"index": "metrics-agent-default",
"processors": []map[string]interface{}{
map[string]interface{}{
"add_fields": map[string]interface{}{
"target": "stream",
"fields": map[string]interface{}{
"type": "metrics",
"dataset": "agent",
"namespace": "default",
},
},
},
},
},
},
},
Expand Down

0 comments on commit 43669f0

Please sign in to comment.