From ebdf8a46a6ae610fed9bcad79dd6cafb33ae4609 Mon Sep 17 00:00:00 2001 From: emilioalvap Date: Tue, 6 Jun 2023 14:43:58 +0200 Subject: [PATCH 1/3] Add nil check to diagnostics processor serializer --- libbeat/publisher/processing/default.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libbeat/publisher/processing/default.go b/libbeat/publisher/processing/default.go index a8ec007562ea..e3a2c961a928 100644 --- a/libbeat/publisher/processing/default.go +++ b/libbeat/publisher/processing/default.go @@ -261,9 +261,13 @@ func newBuilder( // Processors returns a string description of the processor config func (b *builder) Processors() []string { procList := []string{} - for _, proc := range b.processors.list { - procList = append(procList, proc.String()) + + if b.processors != nil { + for _, proc := range b.processors.list { + procList = append(procList, proc.String()) + } } + return procList } From 64c346414372c84c62f3731dc89a332a369e8fba Mon Sep 17 00:00:00 2001 From: emilioalvap Date: Tue, 6 Jun 2023 14:53:23 +0200 Subject: [PATCH 2/3] Add changelog --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index a5c0edee31a4..6b5b94691a6e 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -149,6 +149,7 @@ automatic splitting at root level, if root level element is an array. {pull}3415 - Fix project monitor temp directories permission to include group access. {pull}35398[35398] - Fix output pipeline exit on run_once. {pull}35376[35376] - Fix formatting issue with socket trace timeout. {pull}35434[35434] +- Fix serialization of processors when running diagnostics. {pull}35698[35698] *Heartbeat* From 68224b3de78aee60a166412a5ec6cbc2e408e553 Mon Sep 17 00:00:00 2001 From: emilioalvap Date: Wed, 7 Jun 2023 12:17:26 +0200 Subject: [PATCH 3/3] Add unit test --- libbeat/publisher/processing/default_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libbeat/publisher/processing/default_test.go b/libbeat/publisher/processing/default_test.go index ef58dc97b8ee..6fe057850373 100644 --- a/libbeat/publisher/processing/default_test.go +++ b/libbeat/publisher/processing/default_test.go @@ -480,6 +480,14 @@ func TestProcessingClose(t *testing.T) { assert.True(t, factoryProcessor.closed) } +func TestProcessingDiagnostics(t *testing.T) { + factory, err := MakeDefaultSupport(true, nil)(beat.Info{}, logp.L(), config.NewConfig()) + require.NoError(t, err) + + p := factory.Processors() + assert.Empty(t, p) +} + func fromJSON(in string) mapstr.M { var tmp mapstr.M err := json.Unmarshal([]byte(in), &tmp)