Skip to content

Commit

Permalink
not setting queue_url bucket_arn or non_aws_bucket_name returns error (
Browse files Browse the repository at this point in the history
…#28666)

* not setting queue_url bucket_arn or non_aws_bucket_name returns error
  • Loading branch information
Andrea Spacca authored Oct 28, 2021
1 parent 97818c3 commit 2a1a0ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
4 changes: 1 addition & 3 deletions x-pack/filebeat/input/awss3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 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)
Expand Down
13 changes: 6 additions & 7 deletions x-pack/filebeat/input/awss3/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2a1a0ca

Please sign in to comment.