Skip to content

Filebeat input v2 s3#19756

Closed
urso wants to merge 4 commits intoelastic:masterfrom
urso:filebeat-input-v2-s3
Closed

Filebeat input v2 s3#19756
urso wants to merge 4 commits intoelastic:masterfrom
urso:filebeat-input-v2-s3

Conversation

@urso
Copy link
Copy Markdown

@urso urso commented Jul 8, 2020

  • Refactoring

What does this PR do?

Move s3 input to input v2 API.

This change splits the internal s3Input into s3Input and s3Collector. The s3Input is responsible for configuration only.

The unit tests have been modified, but the integration tests need some more work.

Why is it important?

Update to v2 input API.

Checklist

  • My code follows the style guidelines of this project
    - [ ] I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

Manual testing:

  1. Create an SQS queue and an S3 bucket in the same AWS region using Amazon SQS console.
  2. Configure SQS queue by replacing the access policy attached to the queue with the following queue policy:
{
 "Version": "2012-10-17",
 "Id": "example-ID",
 "Statement": [
  {
   "Sid": "example-statement-ID",
   "Effect": "Allow",
   "Principal": {
    "AWS":"*"  
   },
   "Action": [
    "SQS:SendMessage"
   ],
   "Resource": "<SQS-queue-ARN>",
   "Condition": {
      "ArnLike": { "aws:SourceArn": "arn:aws:s3:*:*:<bucket-name>" }
   }
  }
 ]
}
  1. Using the Amazon S3 console, add a notification configuration requesting Amazon S3 to publish events of the s3:ObjectCreated:* type to your Amazon SQS queue.
  2. Upload an object to the S3 bucket and verify the event notification in the Amazon SQS console.

For running the s3_integration_test.go, environment variables are needed. For example:

QUEUE_URL=https://sqs.us-east-1.amazonaws.com/428152502467/test-fb-ks;AWS_PROFILE_NAME=elastic-beats;S3_BUCKET_REGION=us-east-1;S3_BUCKET_NAME=test-fb-ks

Related issues

@urso urso added refactoring Filebeat Filebeat needs_backport PR is waiting to be backported to other branches. Team:Integrations Label for the Integrations team labels Jul 8, 2020
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 8, 2020
@urso
Copy link
Copy Markdown
Author

urso commented Jul 8, 2020

@exekias @kaiyan-sheng I commented out the integration tests for now. The setup of these tests looks rather 'complicated' and I wonder if we can simplify them a little. I didn't spend much time learning about the purpose of each test. Some help would be appreciated (Note: no need for hurry, I didn't plan to have it ready for 7.9).

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #19756 opened]

  • Start Time: 2020-07-08T20:20:33.625+0000

  • Duration: 17 min 38 sec

Steps errors

Expand to view the steps failures

  • Name: Make check
    • Description: make check

    • Duration: 10 min 47 sec

    • Start Time: 2020-07-08T20:26:50.152+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-07-08T20:36:43.260Z] Stage "Kubernetes" skipped due to earlier failure(s)
[2020-07-08T20:36:43.525Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:43.536Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:43.547Z] Stage "Metricbeat x-pack" skipped due to earlier failure(s)
[2020-07-08T20:36:43.557Z] Stage "Packetbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:43.568Z] Stage "dockerlogbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:43.580Z] Stage "Winlogbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:43.591Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:43.602Z] Stage "Journalbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:43.613Z] Stage "Generators" skipped due to earlier failure(s)
[2020-07-08T20:36:44.954Z] Failed in branch Elastic Agent x-pack
[2020-07-08T20:36:44.964Z] Failed in branch Elastic Agent x-pack Windows
[2020-07-08T20:36:44.974Z] Failed in branch Elastic Agent Mac OS X
[2020-07-08T20:36:44.983Z] Failed in branch Filebeat oss
[2020-07-08T20:36:44.994Z] Failed in branch Filebeat x-pack
[2020-07-08T20:36:45.004Z] Failed in branch Filebeat Mac OS X
[2020-07-08T20:36:45.014Z] Failed in branch Filebeat x-pack Mac OS X
[2020-07-08T20:36:45.024Z] Failed in branch Filebeat Windows
[2020-07-08T20:36:45.034Z] Failed in branch Filebeat x-pack Windows
[2020-07-08T20:36:45.044Z] Failed in branch Auditbeat oss Linux
[2020-07-08T20:36:45.056Z] Failed in branch Auditbeat crosscompile
[2020-07-08T20:36:45.067Z] Failed in branch Auditbeat oss Mac OS X
[2020-07-08T20:36:45.076Z] Failed in branch Auditbeat oss Windows
[2020-07-08T20:36:45.087Z] Failed in branch Auditbeat x-pack
[2020-07-08T20:36:45.097Z] Failed in branch Auditbeat x-pack Mac OS X
[2020-07-08T20:36:45.107Z] Failed in branch Auditbeat x-pack Windows
[2020-07-08T20:36:45.118Z] Failed in branch Libbeat x-pack
[2020-07-08T20:36:45.129Z] Failed in branch Metricbeat OSS Unit tests
[2020-07-08T20:36:45.139Z] Failed in branch Metricbeat OSS Integration tests
[2020-07-08T20:36:45.149Z] Failed in branch Metricbeat Python integration tests
[2020-07-08T20:36:45.161Z] Failed in branch Metricbeat crosscompile
[2020-07-08T20:36:45.171Z] Failed in branch Metricbeat Mac OS X
[2020-07-08T20:36:45.181Z] Failed in branch Metricbeat x-pack Mac OS X
[2020-07-08T20:36:45.191Z] Failed in branch Metricbeat Windows
[2020-07-08T20:36:45.201Z] Failed in branch Metricbeat x-pack Windows
[2020-07-08T20:36:45.211Z] Failed in branch Winlogbeat Windows x-pack
[2020-07-08T20:36:45.221Z] Failed in branch Kubernetes
[2020-07-08T20:36:45.932Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:45.948Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:45.960Z] Stage "Metricbeat x-pack" skipped due to earlier failure(s)
[2020-07-08T20:36:45.971Z] Stage "Winlogbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:45.981Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:45.993Z] Stage "Generators" skipped due to earlier failure(s)
[2020-07-08T20:36:46.560Z] Failed in branch Packetbeat
[2020-07-08T20:36:46.570Z] Failed in branch dockerlogbeat
[2020-07-08T20:36:46.580Z] Failed in branch Journalbeat
[2020-07-08T20:36:47.103Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:47.114Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:47.125Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-07-08T20:36:47.136Z] Stage "Generators" skipped due to earlier failure(s)
[2020-07-08T20:36:47.264Z] Failed in branch Metricbeat x-pack
[2020-07-08T20:36:47.274Z] Failed in branch Winlogbeat
[2020-07-08T20:36:47.771Z] Failed in branch Heartbeat
[2020-07-08T20:36:47.782Z] Failed in branch Libbeat
[2020-07-08T20:36:47.792Z] Failed in branch Functionbeat
[2020-07-08T20:36:47.792Z] Stage "Generators" skipped due to earlier failure(s)
[2020-07-08T20:36:48.038Z] Failed in branch Generators
[2020-07-08T20:36:50.102Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19756/src/github.com/elastic/beats
[2020-07-08T20:36:50.456Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-07-08T20:36:50.484Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19756/src/github.com/elastic/beats/Lint
[2020-07-08T20:36:51.047Z] + cat
[2020-07-08T20:36:51.047Z] + /usr/local/bin/runbld ./runbld-script
[2020-07-08T20:36:51.047Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-07-08T20:36:57.645Z] runbld>>> runbld started
[2020-07-08T20:36:57.645Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-07-08T20:36:59.572Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-19756' in order of occurrence in the config (last value wins).
[2020-07-08T20:37:00.518Z] runbld>>> Debug logging enabled.
[2020-07-08T20:37:00.518Z] runbld>>> Storing result
[2020-07-08T20:37:00.780Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-07-08T20:37:00.780Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200708203700-AC86D741
[2020-07-08T20:37:00.780Z] runbld>>> Adding system facts.
[2020-07-08T20:37:01.725Z] runbld>>> Adding vcs info for the latest commit:  f3c481524a99fcf236f4f9553837e7172e2005a5
[2020-07-08T20:37:01.725Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-07-08T20:37:01.725Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-07-08T20:37:01.725Z] Processing JUnit reports with runbld...
[2020-07-08T20:37:01.725Z] + echo 'Processing JUnit reports with runbld...'
[2020-07-08T20:37:02.301Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-07-08T20:37:02.301Z] runbld>>> DURATION: 26ms
[2020-07-08T20:37:02.301Z] runbld>>> STDOUT: 40 bytes
[2020-07-08T20:37:02.301Z] runbld>>> STDERR: 49 bytes
[2020-07-08T20:37:02.301Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-07-08T20:37:02.301Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19756/src/github.com/elastic/beats
[2020-07-08T20:37:03.249Z] runbld>>> Storing build metadata: 
[2020-07-08T20:37:03.249Z] runbld>>> Adding test report.
[2020-07-08T20:37:03.249Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19756/src/github.com/elastic/beats
[2020-07-08T20:37:03.823Z] runbld>>> Found 0 test output files
[2020-07-08T20:37:03.823Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 0 Skipped: 0
[2020-07-08T20:37:04.085Z] runbld>>> Storing result
[2020-07-08T20:37:04.348Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-07-08T20:37:04.348Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200708203700-AC86D741
[2020-07-08T20:37:04.348Z] runbld>>> Email notification disabled by environment variable.
[2020-07-08T20:37:04.348Z] runbld>>> Slack notification disabled by environment variable.
[2020-07-08T20:37:10.303Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19756
[2020-07-08T20:37:10.514Z] [INFO] getVaultSecret: Getting secrets
[2020-07-08T20:37:10.611Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-08T20:37:11.796Z] + chmod 755 generate-build-data.sh
[2020-07-08T20:37:11.796Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19756/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19756/runs/1 FAILURE 997898
[2020-07-08T20:37:11.796Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19756/runs/1/steps/?limit=10000 -o steps-info.json
[2020-07-08T20:37:12.046Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19756/runs/1/tests/?status=FAILED -o tests-errors.json
[2020-07-08T20:37:12.297Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19756/runs/1/log/ -o pipeline-log.txt

@kaiyan-sheng
Copy link
Copy Markdown
Contributor

@urso Thank you so much for converting s3 input! I added some steps for setting up S3-SQS for testing in the PR description. I have the environment setup already for testing so I can test this if that's easier.

@urso
Copy link
Copy Markdown
Author

urso commented Jul 21, 2020

Closing. Work is continued in #20005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Filebeat Filebeat needs_backport PR is waiting to be backported to other branches. refactoring Team:Integrations Label for the Integrations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants