GithubHelp home page GithubHelp logo

s3tologgly's Introduction

S3ToLoggly

A Node.js AWS Lambda script that send S3 logs to Loggly

More information about AWS Lambda and Loggly

Get the code and prep it for the uploading to AWS

  • Clone the git repo
git clone https://github.com/psquickitjayant/S3ToLoggly.git
cd S3ToLoggly
  • Install require npm packages.
npm install
  • zip up your code
zip -r S3ToLoggly.zip S3ToLoggly.js node_modules

The resulting zip (S3ToLoggly.zip) is what you will upload to AWS in step 1 below.

Setting up AWS

For all of the AWS setup, I used the AWS console following this example. Below, you will find a high-level description of how to do this. I also found this blog post on how to set things up using the command line tools.

Create and upload the S3ToLoggly Lamba function in the AWS Console

  1. Create lambda function
  2. https://console.aws.amazon.com/lambda/home
  3. Click "Create a Lambda function" button. (Choose "Upload a .ZIP file") * Name: S3ToLoggly * Upload lambda function (zip file you made above.) * Handler:* S3ToLoggly.handler * Role:* In the drop down click "S3 execution role". (This will open a new window to create the role.) * I left the memory at 128MB. In my testing with s3 bucket set upload every 5 minutes this worked for me. You may need to bump this up if your s3 logs are larger.
    * Same advice for Timer, I set it to 10 seconds.
  4. Configure Event Source to call S3ToLoggly when logs added to S3 bucket.
  5. https://console.aws.amazon.com/lambda/home
  6. Make sure the S3ToLoggly lambda function is selected, then click 'Actions->Add event source' * Event source type: S3 * Bucket: Choose the S3 bucket that contains your logs. * Event type: ObjectCreated (All)
### Configure the S3 buckets with tags the S3ToLoggly uses to know where to send logs.

Using S3 Management Console click the bucket that contains your S3 logs.

  1. Under Properties -> Tags add the following tag:
1. **Key:** loggly-customer-token , **Value:** *your-loggly-customer-token*
2. **Key:** loggly-tag, **Value:** *s3_lambda_tag* (Or what ever you want.)

NOTE: This script sends raw logs to Loggly. If you want to parse your own logs and convert them to JSON, you can extend the functionality of exports.handler function. JSON logs can be automatically parsed in Loggly. See more for JSON Automated Parsing in Loggly.

s3tologgly's People

Contributors

varshneyjayant avatar

Watchers

Michael Gray avatar James Cloos 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.