Code Monkey home page Code Monkey logo

elastalert-lambda's Introduction

elastalert-lambda

Lambda handler for running elastalert serverless.

Usage

  • Clone this repository and jump into it:
$ git clone https://github.com/beezz/elastalert-lambda.git && cd elastalert-lambda
  • Update configuration in config.yaml

  • Put your rules into rules directory (remove example rules)

  • Build deployment package dist/lambda.zip using command:

$ make lambda
  • Deploy to AWS and schedule
    • Deployment package / code dist/lambda.zip
    • Handler name elastalert_lambda.handler
    • Runtime Python 2.7
    • Timeout and memory depends on the amount of data in your rules queries as on complexity of the queries
    • Schedule and event to trigger the function (as defined in configuration run_every)

How it works

Lambda handler for elastalert works by executing the main entry point of elastalert with predefined arguments

  • --config pointing to config.yaml
  • --end set to current timestamp (datetime.datetime.utcnow())

You can override those defaults and also add additional arguments using environmental variable ARGS or as part of sent event, also with ARGS key.

Automatic creation of indexes and mappings (elastalert-create-index) add EA_CREATE_INDEX environmental variable to the lambda function. You can control the argument supplied to the index creation using the EA_CREATE_INDEX_ARGS environmental variable. If you omit that one, the elastalert config.yaml is supplied via the --config flag.

Example of create index args setting EA_CREATE_INDEX="--host localhost --user user --password pass".

Check all supported arguments elastalert --help

Testing locally

Simply by executing:

$ python elastalert_lambda.py

Passing arguments using environment:

$ ARGS="--debug --patience seconds=5 --es_debug" python elastalert_lambda.py

Passing arguments using event:

$ echo '{"ARGS": "--debug --patience seconds=5 --es_debug"}' | python elastalert_lambda.py

elastalert-lambda's People

Contributors

beezz avatar christophshyper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

elastalert-lambda's Issues

Error on Lambda.

Syntax error in module 'elastalert_lambda': invalid syntax (__init__.py, line 284)

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.