From 761d9e409c353988ff55efc9bd0e36938055251f Mon Sep 17 00:00:00 2001 From: Kerry Gallagher Date: Mon, 20 Jun 2022 16:20:46 +0100 Subject: [PATCH] [Metricbeat] Stop continual error with multiple Logstash pipelines (#31985) --- metricbeat/module/logstash/node/data.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/metricbeat/module/logstash/node/data.go b/metricbeat/module/logstash/node/data.go index 42fcbfe3f488..0ccc42ef7df4 100644 --- a/metricbeat/module/logstash/node/data.go +++ b/metricbeat/module/logstash/node/data.go @@ -89,16 +89,15 @@ func eventMapping(r mb.ReporterV2, content []byte, pipelines []logstash.Pipeline return errors.Wrap(err, "failure parsing Logstash Node API response") } - fields, err := schema.Apply(data) - if err != nil { - return errors.Wrap(err, "failure applying node schema") - } - pipelines = getUserDefinedPipelines(pipelines) clusterToPipelinesMap := makeClusterToPipelinesMap(pipelines, overrideClusterUUID) for clusterUUID, pipelines := range clusterToPipelinesMap { for _, pipeline := range pipelines { + fields, err := schema.Apply(data) + if err != nil { + return errors.Wrap(err, "failure applying node schema") + } removeClusterUUIDsFromPipeline(pipeline) // Rename key: graph -> representation @@ -115,6 +114,7 @@ func eventMapping(r mb.ReporterV2, content []byte, pipelines []logstash.Pipeline }, ModuleFields: mapstr.M{}, } + event.MetricSetFields.Update(fields) if err = commonFieldsMapping(&event, fields); err != nil {