Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add S3 input to retrieve logs from AWS S3 buckets #12640

Merged
merged 59 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
772de35
Add S3 input to retrieve logs from AWS S3 buckets
kaiyan-sheng Jun 21, 2019
a98e05c
run mage fmt update
kaiyan-sheng Jun 21, 2019
9b11cb0
update doc
kaiyan-sheng Jun 24, 2019
9d5a624
Change bucketName to bucket_name
kaiyan-sheng Jun 24, 2019
252e2d7
Run make update
kaiyan-sheng Jun 25, 2019
cf23865
remove receiveMessages function and put goroutines directly in Run
kaiyan-sheng Jun 26, 2019
b8d017a
Added several methods to read resp.body to string
kaiyan-sheng Jun 26, 2019
6ae5e46
Use bufio.NewReader to read s3 GetObject response body
kaiyan-sheng Jun 27, 2019
0c692bd
Update changelog
kaiyan-sheng Jun 27, 2019
1fdf6fe
Change to push individual event when it's ready
kaiyan-sheng Jun 28, 2019
0f44668
add getAWSCredentials function
kaiyan-sheng Jun 28, 2019
605e51c
Add shared_config_profile option and read from ~/.aws/credentials
kaiyan-sheng Jun 28, 2019
9c4aaee
Update aws credentials with credential_profile_name
kaiyan-sheng Jun 30, 2019
87b2307
fix wg.wait and change log.offset to be byte size instead of line number
kaiyan-sheng Jul 1, 2019
68f1bf7
ChangeMessageVisibility when process one message longer than 1/2 visi…
kaiyan-sheng Jul 2, 2019
0a16db3
Add changeMessageVisibility and check time spend on reading log file
kaiyan-sheng Jul 2, 2019
6121b57
rebase
kaiyan-sheng Jul 2, 2019
aa70bd8
Move select into a separate go routine
kaiyan-sheng Jul 3, 2019
cbf7f60
Remove bucket_names from config and add missing return
kaiyan-sheng Jul 7, 2019
561e6bc
Fix unit tests
kaiyan-sheng Jul 8, 2019
5d52a84
Add VisibilityTimeout into config with default to be 5min
kaiyan-sheng Jul 8, 2019
339b2a5
Add channel to close in Stop()
kaiyan-sheng Jul 9, 2019
991c29d
Add id for each event
kaiyan-sheng Jul 11, 2019
12ee91c
add sqsMessage struct to decode resp body from sqs
kaiyan-sheng Jul 12, 2019
af21325
Change event id to hash + offset
kaiyan-sheng Jul 15, 2019
e841d36
Add error channel to handleS3Objects
kaiyan-sheng Jul 15, 2019
8744cbf
Move deleteMessage after done
kaiyan-sheng Jul 15, 2019
9fb151e
Replace done channel with errC channel
kaiyan-sheng Jul 16, 2019
824689a
Update documentation
kaiyan-sheng Jul 16, 2019
3f4bd22
Fix unit test
kaiyan-sheng Jul 16, 2019
1314fa3
Fix unit test
kaiyan-sheng Jul 16, 2019
ffe44ad
Move sendKeepAlive into separate function
kaiyan-sheng Jul 18, 2019
bc480d2
separate processMessage into a function
kaiyan-sheng Jul 19, 2019
62a7b30
Add bounded message queue
kaiyan-sheng Jul 20, 2019
1cedb02
Uncomment meta in event
kaiyan-sheng Jul 22, 2019
47d378b
Revert "Uncomment meta in event"
kaiyan-sheng Jul 22, 2019
dafbea7
Revert "Add bounded message queue"
kaiyan-sheng Jul 22, 2019
566c82a
add workerOnce to only start Run() once
kaiyan-sheng Jul 22, 2019
1c46b03
Rebase to use x-pack libbeat common GetAWSCredentials
kaiyan-sheng Jul 22, 2019
5a81235
Change defaultConfig to be a function
kaiyan-sheng Jul 22, 2019
6b06d0f
Move Validate into config.go
kaiyan-sheng Jul 23, 2019
efa648f
Add channelContext
kaiyan-sheng Jul 23, 2019
a271dc1
Add s3Context
kaiyan-sheng Jul 23, 2019
da21e06
Remove parallel for handleS3Objects
kaiyan-sheng Jul 23, 2019
d733b3a
Uncomment Meta in event
kaiyan-sheng Jul 23, 2019
8943d13
fix unit test
kaiyan-sheng Jul 23, 2019
bce8452
Replace select case with p.context.Err() == nil
kaiyan-sheng Jul 23, 2019
c916745
rebase and update to use new connector
kaiyan-sheng Jul 29, 2019
c3a26ae
Add end to end ACK in connector
kaiyan-sheng Jul 29, 2019
59bcd61
Ignore aws ErrCodeRequestCanceled
kaiyan-sheng Jul 29, 2019
e0e83d9
Run mage fmt update
kaiyan-sheng Jul 29, 2019
775c628
Change ref to start from 1
kaiyan-sheng Jul 31, 2019
6558743
Change to newS3BucketReader
kaiyan-sheng Jul 31, 2019
0ce8dc6
Add waitgroup
kaiyan-sheng Jul 31, 2019
610d854
Add documentation for setting up sqs s3 and manual testing
kaiyan-sheng Jul 31, 2019
837f16a
move manual testing into a separate doc
kaiyan-sheng Aug 1, 2019
13dd71a
Add s3 input doc into filebeat-options
kaiyan-sheng Aug 2, 2019
87be1a9
rebase and add filebeat-s3-input-config
kaiyan-sheng Aug 2, 2019
e132c19
Fix link in metricbeat doc
kaiyan-sheng Aug 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Parse more fields from Elasticsearch slowlogs. {pull}11939[11939]
- Update module pipelines to enrich events with autonomous system fields. {pull}13036[13036]
- Add module for ingesting IBM MQ logs. {pull}8782[8782]
- Add S3 input to retrieve logs from AWS S3 buckets. {pull}12640[12640] {issue}12582[12582]

*Heartbeat*

Expand Down
35 changes: 35 additions & 0 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ grouped in the following categories:

* <<exported-fields-apache>>
* <<exported-fields-auditd>>
* <<exported-fields-aws>>
* <<exported-fields-beat-common>>
* <<exported-fields-cisco>>
* <<exported-fields-cloud>>
Expand Down Expand Up @@ -986,6 +987,40 @@ alias to: destination.address

--

[[exported-fields-aws]]
== aws fields

AWS fields from s3 input.



[float]
=== s3

S3 related information.



*`s3.bucket_name`*::
+
--
Name of the S3 bucket that this log retrieved from.


type: keyword

--

*`s3.object_key`*::
+
--
Name of the S3 object that this log retrieved from.


type: keyword

--

[[exported-fields-beat-common]]
== Beat fields

Expand Down
3 changes: 3 additions & 0 deletions filebeat/docs/filebeat-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ You can configure {beatname_uc} to use the following inputs:
* <<{beatname_lc}-input-docker>>
* <<{beatname_lc}-input-tcp>>
* <<{beatname_lc}-input-syslog>>
* <<{beatname_lc}-input-s3>>
* <<{beatname_lc}-input-netflow>>
* <<{beatname_lc}-input-google-pubsub>>

Expand All @@ -70,6 +71,8 @@ include::inputs/input-tcp.asciidoc[]

include::inputs/input-syslog.asciidoc[]

include::../../x-pack/filebeat/docs/inputs/input-aws-s3.asciidoc[]

include::../../x-pack/filebeat/docs/inputs/input-netflow.asciidoc[]

include::../../x-pack/filebeat/docs/inputs/input-google-pubsub.asciidoc[]
2 changes: 1 addition & 1 deletion metricbeat/docs/modules/aws.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ for a list of AWS services that publish metrics to CloudWatch.
dimensions to Amazon CloudWatch every minute.

[id="aws-credentials-config"]
include::{libbeat-xpack-dir}/docs/aws-credentials-config.asciidoc[]
include::../../../../../metricbeat/docs/aws-credentials-examples.asciidoc


[float]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
"path": "github.com/aws/aws-sdk-go-v2/aws/awserr",
"revision": "098e15df3044cf1b04a222c1c33c3e6135ac89f3",
"revisionTime": "2019-05-28T21:51:27Z",
"tree": true,
"version": "v0.9.0",
"versionExact": "v0.9.0"
},
Expand Down Expand Up @@ -512,7 +513,15 @@
"versionExact": "v0.9.0"
},
{
"checksumSHA1": "VOdJIdzSIvHiu23lwsxFOTeBrWk=",
"checksumSHA1": "e0qV+W56A3/QgA1xDkaAwTIffAw=",
"path": "github.com/aws/aws-sdk-go-v2/service/s3/s3iface",
"revision": "098e15df3044cf1b04a222c1c33c3e6135ac89f3",
"revisionTime": "2019-05-28T21:51:27Z",
"version": "v0.9.0",
"versionExact": "v0.9.0"
},
{
"checksumSHA1": "Y+mpKnu57hYbC4z3nrSFR9BkAec=",
"path": "github.com/aws/aws-sdk-go-v2/service/sqs",
"revision": "098e15df3044cf1b04a222c1c33c3e6135ac89f3",
"revisionTime": "2019-05-28T21:51:27Z",
Expand Down
20 changes: 20 additions & 0 deletions x-pack/filebeat/_meta/common.reference.inputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,23 @@

# Path to a JSON file containing the credentials and key used to subscribe.
credentials_file: ${path.config}/my-pubsub-subscriber-credentials.json

#------------------------------ S3 input --------------------------------
# Beta: Config options for AWS S3 input
#- type: s3
#enabled: false

# AWS Credentials
# If access_key_id and secret_access_key are configured, then use them to make api calls.
# If not, s3 input will load default AWS config or load with given profile name.
#access_key_id: '${AWS_ACCESS_KEY_ID:""}'
#secret_access_key: '${AWS_SECRET_ACCESS_KEY:""}'
#session_token: '${AWS_SESSION_TOKEN:"”}'
#credential_profile_name: test-s3-input

# Queue urls (required) to receive queue messages from
#queue_urls: ["https://sqs.us-east-1.amazonaws.com/1234/test-s3-logs-queue"]

# The duration (in seconds) that the received messages are hidden from subsequent
# retrieve requests after being retrieved by a ReceiveMessage request.
#visibility_timeout: 300
Loading