From f445ec614bfd46465ec1cc4fe0c6860830b1d509 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Wed, 27 Oct 2021 10:44:53 +0200 Subject: [PATCH 1/5] not setting queue_url bucket_arn or non_aws_bucket_name returns error --- x-pack/filebeat/input/awss3/config.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/filebeat/input/awss3/config.go b/x-pack/filebeat/input/awss3/config.go index d1d4989ead8..fe2ad4062d3 100644 --- a/x-pack/filebeat/input/awss3/config.go +++ b/x-pack/filebeat/input/awss3/config.go @@ -13,7 +13,6 @@ import ( "github.com/elastic/beats/v7/libbeat/common/cfgtype" "github.com/elastic/beats/v7/libbeat/common/match" - "github.com/elastic/beats/v7/libbeat/logp" "github.com/elastic/beats/v7/libbeat/reader/parser" "github.com/elastic/beats/v7/libbeat/reader/readfile" "github.com/elastic/beats/v7/libbeat/reader/readfile/encoding" @@ -65,8 +64,7 @@ func (c *config) Validate() error { } } if len(enabled) == 0 { - logp.NewLogger(inputName).Warnf("neither queue_url, bucket_arn, non_aws_bucket_name were provided, input %s will stop", inputName) - return nil + return fmt.Errorf("neither queue_url, bucket_arn nor non_aws_bucket_name were provided, input %s will stop", inputName) } else if len(enabled) > 1 { return fmt.Errorf("queue_url <%v>, bucket_arn <%v>, non_aws_bucket_name <%v> "+ "cannot be set at the same time", c.QueueURL, c.BucketARN, c.NonAWSBucketName) From 499827e5761acf7994dd992bf227456e4a55442e Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Wed, 27 Oct 2021 11:00:37 +0200 Subject: [PATCH 2/5] CHANGELOG entry --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index d8e8b320023..4d8401a7cc9 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -332,6 +332,7 @@ for a few releases. Please use other tools provided by Elastic to fetch data fro - Correctly track bytes read when max_bytes is exceeded. {issue}28317[28317] {pull}28352[28352] - Fix initialization of http client in Cloudfoundry input. {issue}28271[28271] {pull}28277[28277] - Fix aws-s3 input by checking if GetObject API call response content type exists. {pull}28457[28457] +- Breaking change: fail to start Filebat is none between `queue_url`, `bucket_arn` or `non_aws_bucket_name` is set for a configured aws-s3 input {issue}13911[13911] {pull}28666[28666] *Heartbeat* From e52cdad60306790fe5458ed343e6d572a4157b90 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Wed, 27 Oct 2021 17:14:42 +0200 Subject: [PATCH 3/5] fix tests --- x-pack/filebeat/input/awss3/config.go | 2 +- x-pack/filebeat/input/awss3/config_test.go | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/x-pack/filebeat/input/awss3/config.go b/x-pack/filebeat/input/awss3/config.go index fe2ad4062d3..5b8308d1771 100644 --- a/x-pack/filebeat/input/awss3/config.go +++ b/x-pack/filebeat/input/awss3/config.go @@ -64,7 +64,7 @@ func (c *config) Validate() error { } } if len(enabled) == 0 { - return fmt.Errorf("neither queue_url, bucket_arn nor non_aws_bucket_name were provided, input %s will stop", inputName) + return errors.New("neither queue_url, bucket_arn nor non_aws_bucket_name were provided") } else if len(enabled) > 1 { return fmt.Errorf("queue_url <%v>, bucket_arn <%v>, non_aws_bucket_name <%v> "+ "cannot be set at the same time", c.QueueURL, c.BucketARN, c.NonAWSBucketName) diff --git a/x-pack/filebeat/input/awss3/config_test.go b/x-pack/filebeat/input/awss3/config_test.go index e7ece7a6269..189ce447ff8 100644 --- a/x-pack/filebeat/input/awss3/config_test.go +++ b/x-pack/filebeat/input/awss3/config_test.go @@ -113,18 +113,17 @@ func TestConfig(t *testing.T) { }, }, { - "error on no queueURL and s3Bucket", + "error on no queueURL and s3Bucket and nonAWSS3Bucket", "", "", "", common.MapStr{ - "queue_url": "", - "bucket_arn": "", - }, - "", - func(queueURL, s3Bucket string, nonAWSS3Bucket string) config { - return makeConfig("", "", "") + "queue_url": "", + "bucket_arn": "", + "non_aws_bucket_name": "", }, + "neither queue_url, bucket_arn nor non_aws_bucket_name were provided", + nil, }, { "error on both queueURL and s3Bucket", From 0f06fda454f88466f398a4db13a08a0dd326d10e Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Wed, 27 Oct 2021 18:27:55 +0200 Subject: [PATCH 4/5] cr fix --- CHANGELOG.next.asciidoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 4d8401a7cc9..c39cb63bbfc 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -100,6 +100,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Remove deprecated fields in coredns module. {pull}28196[28196] - Remove old `httpjson` config implementation. {pull}28054[28054] - Added dataset `threatq` to the `threatintel` module to ingest indicators from ThreatQ {issue}27423[27423] +- Fail to start Filebat if none between `queue_url`, `bucket_arn` or `non_aws_bucket_name` is set for a configured aws-s3 input {issue}13911[13911] {pull}28666[28666] *Heartbeat* @@ -332,7 +333,7 @@ for a few releases. Please use other tools provided by Elastic to fetch data fro - Correctly track bytes read when max_bytes is exceeded. {issue}28317[28317] {pull}28352[28352] - Fix initialization of http client in Cloudfoundry input. {issue}28271[28271] {pull}28277[28277] - Fix aws-s3 input by checking if GetObject API call response content type exists. {pull}28457[28457] -- Breaking change: fail to start Filebat is none between `queue_url`, `bucket_arn` or `non_aws_bucket_name` is set for a configured aws-s3 input {issue}13911[13911] {pull}28666[28666] + *Heartbeat* From 6e5a2e539d087066a1b637a1438a15346a33d786 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Thu, 28 Oct 2021 09:35:52 +0200 Subject: [PATCH 5/5] cr fix --- CHANGELOG.next.asciidoc | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index c39cb63bbfc..4cc924c427f 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -334,7 +334,6 @@ for a few releases. Please use other tools provided by Elastic to fetch data fro - Fix initialization of http client in Cloudfoundry input. {issue}28271[28271] {pull}28277[28277] - Fix aws-s3 input by checking if GetObject API call response content type exists. {pull}28457[28457] - *Heartbeat* - Fixed excessive memory usage introduced in 7.5 due to over-allocating memory for HTTP checks. {pull}15639[15639]