Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyan-sheng committed Nov 8, 2021
1 parent d43b7b5 commit 91e894e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
10 changes: 9 additions & 1 deletion x-pack/filebeat/docs/inputs/input-aws-s3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The use of SQS notification is preferred: polling list of S3 objects is expensiv
in terms of performance and costs and should be preferably used only when no SQS
notification can be attached to the S3 buckets. This input can, for example, be
used to receive S3 access logs to monitor detailed records for the requests that
are made to a bucket.
are made to a bucket. This input also supports S3 notification from SNS to SQS.

SQS notification method is enabled setting `queue_url` configuration value.
S3 bucket list polling method is enabled setting `bucket_arn` configuration value.
Expand Down Expand Up @@ -386,6 +386,14 @@ create a notification through SQS. Please see
https://docs.aws.amazon.com/AmazonS3/latest/dev/ways-to-add-notification-config-to-bucket.html#step1-create-sqs-queue-for-notification[create-sqs-queue-for-notification]
for more details.

[float]
=== S3 -> SNS -> SQS setup
If you would like to use the bucket notification in multiple different consumers
(others than {beatname_lc}), you should use an SNS topic for the bucket notification.
Please see https://docs.aws.amazon.com/AmazonS3/latest/userguide/ways-to-add-notification-config-to-bucket.html#step1-create-sns-topic-for-notification[create-SNS-topic-for-notification]
for more details. SQS queue will be configured as a
https://docs.aws.amazon.com/sns/latest/dg/sns-sqs-as-subscriber.html[subscriber to the SNS topic].

[float]
=== Parallel Processing

Expand Down
17 changes: 8 additions & 9 deletions x-pack/filebeat/input/awss3/input_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ const (
)

type terraformOutputData struct {
AWSRegion string `yaml:"aws_region"`
BucketName string `yaml:"bucket_name"`
QueueURL string `yaml:"queue_url"`
BucketName2 string `yaml:"bucket_name_for_sns"`
QueueURL2 string `yaml:"queue_url_for_sns"`
AWSRegion string `yaml:"aws_region"`
BucketName string `yaml:"bucket_name"`
QueueURL string `yaml:"queue_url"`
BucketNameForSNS string `yaml:"bucket_name_for_sns"`
QueueURLForSNS string `yaml:"queue_url_for_sns"`
}

func getTerraformOutputs(t *testing.T) terraformOutputData {
Expand Down Expand Up @@ -458,12 +458,12 @@ func TestInputRunSNS(t *testing.T) {
tfConfig := getTerraformOutputs(t)

// Ensure SQS is empty before testing.
drainSQS(t, tfConfig.AWSRegion, tfConfig.QueueURL2)
drainSQS(t, tfConfig.AWSRegion, tfConfig.QueueURLForSNS)

// Ensure metrics are removed before testing.
monitoring.GetNamespace("dataset").GetRegistry().Remove(inputID)

uploadS3TestFiles(t, tfConfig.AWSRegion, tfConfig.BucketName2,
uploadS3TestFiles(t, tfConfig.AWSRegion, tfConfig.BucketNameForSNS,
"testdata/events-array.json",
"testdata/invalid.json",
"testdata/log.json",
Expand All @@ -474,7 +474,7 @@ func TestInputRunSNS(t *testing.T) {
"testdata/log.txt", // Skipped (no match).
)

s3Input := createInput(t, makeTestConfigSQS(tfConfig.QueueURL2))
s3Input := createInput(t, makeTestConfigSQS(tfConfig.QueueURLForSNS))

inputCtx, cancel := newV2Context()
t.Cleanup(cancel)
Expand All @@ -486,7 +486,6 @@ func TestInputRunSNS(t *testing.T) {
defer close(client.Channel)
go func() {
for event := range client.Channel {
// Fake the ACK handling that's not implemented in pubtest.
event.Private.(*eventACKTracker).ACK()
}
}()
Expand Down

0 comments on commit 91e894e

Please sign in to comment.