diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index d8ff936de02..8861e6f417f 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -51,6 +51,8 @@ https://github.com/elastic/beats/compare/v6.5.0...6.x[Check the HEAD diff] *Metricbeat* +- Add missing namespace field in http server metricset {pull}7890[7890] + *Packetbeat* *Winlogbeat* diff --git a/metricbeat/module/http/server/server.go b/metricbeat/module/http/server/server.go index 283ba1d583f..492e92bbcb3 100644 --- a/metricbeat/module/http/server/server.go +++ b/metricbeat/module/http/server/server.go @@ -18,7 +18,8 @@ package server import ( - "github.com/elastic/beats/libbeat/common" + "fmt" + "github.com/elastic/beats/libbeat/common/cfgwarn" serverhelper "github.com/elastic/beats/metricbeat/helper/server" "github.com/elastic/beats/metricbeat/helper/server/http" @@ -83,10 +84,13 @@ func (m *MetricSet) Run(reporter mb.PushReporterV2) { reporter.Error(err) } else { event := mb.Event{} - event.ModuleFields = common.MapStr{} - metricSetName := fields[mb.NamespaceKey].(string) - delete(fields, mb.NamespaceKey) - event.ModuleFields.Put(metricSetName, fields) + ns, ok := fields[mb.NamespaceKey].(string) + if ok { + ns = fmt.Sprintf("http.%s", ns) + delete(fields, mb.NamespaceKey) + } + event.MetricSetFields = fields + event.Namespace = ns reporter.Event(event) }