From 468122dc1f96ec0bc7f6b7cf0511dc94ca3bb940 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Tue, 11 Jul 2023 17:21:37 +0930 Subject: [PATCH] x-pack/filebeat/input/awss3: fix priority of region name configurations The code currently prioritises the region_name configuration, even when it is not provided, against the claims of the documentation. Make a check whether it is empty before claiming a conflict and using it. --- CHANGELOG.next.asciidoc | 1 + x-pack/filebeat/input/awss3/input.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 25a6b617a63..60f3490ea9e 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -147,6 +147,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Improve error reporting and fix IPv6 handling of TCP and UDP metric collection. {pull}35996[35996] - Fix handling of NUL-terminated log lines in Fortinet Firewall module. {issue}36026[36026] {pull}36027[36027] - Make redact field configuration recommended in CEL input and log warning if missing. {pull}36008[36008] +- Fix handling of region name configuration in awss3 input {pull}36034[36034] *Heartbeat* diff --git a/x-pack/filebeat/input/awss3/input.go b/x-pack/filebeat/input/awss3/input.go index 4f45f914144..c9812e98308 100644 --- a/x-pack/filebeat/input/awss3/input.go +++ b/x-pack/filebeat/input/awss3/input.go @@ -119,7 +119,7 @@ func (in *s3Input) Run(inputContext v2.Context, pipeline beat.Pipeline) error { if err != nil && in.config.RegionName == "" { return fmt.Errorf("failed to get AWS region from queue_url: %w", err) } - if regionName != in.config.RegionName { + if in.config.RegionName != "" && regionName != in.config.RegionName { inputContext.Logger.Warnf("configured region disagrees with queue_url region: %q != %q: using %[1]q", in.config.RegionName, regionName) regionName = in.config.RegionName