Code Monkey home page Code Monkey logo

le_lambda's Introduction

le_lambda

Follow the instructions below to send logs stored on AWS S3 to Logentries.

All source code and dependencies can be found on the le_lambda Github page.

Example use cases:
  • Forwarding AWS ELB and CloudFront logs
    • (make sure to set ELB/CloudFront to write logs every 5 minutes)
    • When forwarding these logs, the script will format the log lines according to Logentries KVP spec to make them easier to analyze
  • Forwarding OpenDNS logs

Obtain log token(s)

  1. Log in to your Logentries account

  2. Add a new token based log

    • Optional: repeat to add second log for debugging

Deploy the script on AWS Lambda

  1. Create a new Lambda function

  2. Choose the Python blueprint for S3 objects

    Choose Blueprint

  3. Configure triggers:

    • Choose the bucket log files are being stored in
    • Set event type "Object Created (All)"
    • Tick "Enable Trigger" checkbox
  4. Configure function:

    • Give your function a name
    • Set runtime to Python 2.7
  5. Edit code:

    • Edit the contents of le_config.py
    • Replace values of log_token and debug_token with tokens obtained earlier.
    • Create a .ZIP file, containing the updated le_config.py, le_lambda.py and the folder certifi
      • Make sure the files and certifi folder are in the root of the ZIP archive
    • Choose "Upload a .ZIP file" in "Code entry type" dropdown and upload the archive created in previous step
  6. Lambda function handler and role

    • Change the "Handler" value to le_lambda.lambda_handler
    • Choose "Create a new role from template" from dropdown and give it a name below.
    • Leave "Policy templates" to pre-populated value
  7. Advanced settings:

    • Set memory to 1536 MB (script only runs for seconds at a time)
    • Set timeout to a high value, just below of log file creation frequency
      • Below example is configured for ELB logs written every 5 minutes
    • Leave VPC value to "No VPC" as the script only needs S3 access
  8. Enable function:

    • Click "Create function"

Gotchas:

  • The "Test" button execution in AWS Lambda will ALWAYS fail as the trigger is not provided by the built in test function. In order to verify, upload a sample file to source bucket

le_lambda's People

Contributors

omgapuppy avatar arithmetric avatar stephenhynes7 avatar ardimehist-r7 avatar

Watchers

 avatar

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.