From a7f87f27f5d99a167ee7a013e1ea4b43c4c72840 Mon Sep 17 00:00:00 2001 From: Khushi Jain Date: Mon, 27 Jul 2026 19:16:56 +0530 Subject: [PATCH 1/2] Remove exception for packetbeat when setting shutdown_timeout --- x-pack/libbeat/cmd/instance/beat.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/x-pack/libbeat/cmd/instance/beat.go b/x-pack/libbeat/cmd/instance/beat.go index f8228fbc3526..81720c7f2c95 100644 --- a/x-pack/libbeat/cmd/instance/beat.go +++ b/x-pack/libbeat/cmd/instance/beat.go @@ -93,18 +93,14 @@ func NewBeatForReceiver(settings instance.Settings, receiverConfig map[string]an } // Set the default shutdown timeout to 5s. The beat default is 1s, which can be too short for the otel pipeline. - // Packetbeat is excluded because its shutdown_timeout has different semantics. - // See https://github.com/elastic/beats/issues/52031 - if b.Info.Beat != "packetbeat" { - switch beatSection := receiverConfig[b.Info.Beat].(type) { - case map[string]any: - if _, alreadySet := beatSection["shutdown_timeout"]; !alreadySet { - beatSection["shutdown_timeout"] = receiverPublisherCloseTimeout.String() - } - case nil: - receiverConfig[b.Info.Beat] = map[string]any{ - "shutdown_timeout": receiverPublisherCloseTimeout.String(), - } + switch beatSection := receiverConfig[b.Info.Beat].(type) { + case map[string]any: + if _, alreadySet := beatSection["shutdown_timeout"]; !alreadySet { + beatSection["shutdown_timeout"] = receiverPublisherCloseTimeout.String() + } + case nil: + receiverConfig[b.Info.Beat] = map[string]any{ + "shutdown_timeout": receiverPublisherCloseTimeout.String(), } } From e8d8550dc91b158475dac846818cd92b50d46b3b Mon Sep 17 00:00:00 2001 From: Khushi Jain Date: Thu, 30 Jul 2026 14:49:23 +0530 Subject: [PATCH 2/2] fix test --- x-pack/libbeat/cmd/instance/beat_test.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/x-pack/libbeat/cmd/instance/beat_test.go b/x-pack/libbeat/cmd/instance/beat_test.go index 6d1d8c6a2c68..fb41cf25b6f2 100644 --- a/x-pack/libbeat/cmd/instance/beat_test.go +++ b/x-pack/libbeat/cmd/instance/beat_test.go @@ -16,7 +16,6 @@ import ( "github.com/elastic/beats/v7/filebeat/cmd" "github.com/elastic/beats/v7/filebeat/input/log" - libbeatinstance "github.com/elastic/beats/v7/libbeat/cmd/instance" "github.com/elastic/beats/v7/libbeat/management" "github.com/elastic/beats/v7/x-pack/otel/otelmanager" conf "github.com/elastic/elastic-agent-libs/config" @@ -85,25 +84,6 @@ type: "log"`) }) } -func TestNewBeatForReceiverDoesNotSetPacketbeatShutdownTimeout(t *testing.T) { - cfg := map[string]any{ - "packetbeat": map[string]any{}, - "path.home": t.TempDir(), - } - - _, err := NewBeatForReceiver( - libbeatinstance.Settings{Name: "packetbeat"}, - cfg, - consumertest.NewNop(), - "testcomponent", - zapcore.NewNopCore(), - ) - require.NoError(t, err) - - assert.NotContains(t, cfg["packetbeat"], "shutdown_timeout", - "packetbeat must retain its own shutdown timeout semantics") -} - func TestNewBeatForReceiverMetricLoggingDefault(t *testing.T) { tmpDir := t.TempDir() baseCfg := map[string]any{