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

[lookup_tables] support for S3 lookup table files #751

Merged
merged 1 commit into from
May 25, 2018

Conversation

chunyong-lin
Copy link
Contributor

to: @ryandeivert or @austinbyers
cc: @airbnb/streamalert-maintainers
size: medium
resolves N/A

Background

This PR is to support lookup tables in Rule Processor. The lookup tables are globally shared and can be referenced in a rule.

The lookup tables feature will download json files from S3 buckets and load them into memory. The buckets info can be configured in conf/global.json, for example,

"infrastructure": {
    "lookup_tables": {
      "buckets": {
        "bucket_name": [
          "foo.json",
          "bar.json"
        ]
      },
      "cache_refresh_minutes": 10,
      "enabled": false
    },
...
}

Changes

  • Add a new class LookupTables to handle downloading files from S3 buckets and loading them into memory. It also refreshes lookup tables, similar to how to refresh rule table.
  • Mock S3 bucket for integration and unit testing.

Testing

  • Rule testing
python manage.py lambda test --processor all
...
StreamAlertCLI [INFO]: (66/66) Successful Tests
StreamAlertCLI [INFO]: (36/36) Alert Tests Passed
  • Unit testing
./tests/scripts/unit_tests.sh
...
Ran 749 tests in 12.404s

OK

Copy link
Contributor

@austinbyers austinbyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❇️

@chunyong-lin chunyong-lin force-pushed the support_lookup_tables branch from 7fc9d7d to 7984b22 Compare May 25, 2018 18:48
@coveralls
Copy link

coveralls commented May 25, 2018

Coverage Status

Coverage remained the same at 97.649% when pulling 7fc9d7d on support_lookup_tables into 5c24f16 on master.

@chunyong-lin chunyong-lin merged commit a7d5c59 into master May 25, 2018
@austinbyers austinbyers deleted the support_lookup_tables branch May 26, 2018 01:54
@ryandeivert ryandeivert added this to the 2.0.0 milestone Jul 9, 2018
@ryandeivert ryandeivert changed the title [lookup_tables] Support lookup tables [lookup_tables] support for S3 lookup table files Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants