8000 GitHub - convox/papertrail: Send Kinesis events to Papertrail with a Lambda function.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Send Kinesis events to Papertrail with a Lambda function.

Notifications You must be signed in to change notification settings

convox/papertrail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

convox/papertrail

Send Kinesis events to Papertrail via a Lambda function.

Development

$ make
npm install rollbar winston winston-papertrail
...

zip -r lambda.zip index.js node_modules
updating: index.js (deflated 44%)
updating: node_modules/ (stored 0%)
updating: node_modules/winston/ (stored 0%)
...

$ AWS_DEFAULT_PROFILE=release make release
aws s3 cp lambda.zip s3://convox/lambda/papertrail.zip  --acl public-read
upload: ./lambda.zip to s3://convox/lambda/papertrail.zip

Updating a production user

Once you've released the function, it will become the default for all new users.

If you need to update a exisiting lambda function, use a url of the form:

https://s3.amazonaws.com/convox-us-east-1/lambda/papertrail.zip

Design

This Lambda function package is used in conjunction with the convox services commands:

$ convox services create papertrail pt
$ convox services link pt --app myapp

It is intended to be configured and installed via CloudFormation.

The handler introspects a CloudFormation stack matching the Lambda function name to find the Papertrail URL Parameter. It takes advantage of container reuse and saves this setting on the /tmp file system to avoid excessive CloudFormation Describe Stack API calls.

When the function has an EventSourceMapping (convox services link), it is invoked with Kinesis events which are sent to Papertrail over syslog via the Winston library.

Architecture

Contributing

Test Event

{
  "Records": [
    {
      "eventID": "shardId-000000000000:49545115243490985018280067714973144582180062593244200961",
      "eventVersion": "1.0",
      "kinesis": {
        "partitionKey": "partitionKey-3",
        "data": "d2ViOiBoZWxsbywgd29ybGQh",
        "kinesisSchemaVersion": "1.0",
        "sequenceNumber": "49545115243490985018280067714973144582180062593244200961"
      },
      "invokeIdentityArn": "arn:aws:iam::EXAMPLE",
      "eventName": "aws:kinesis:record",
      "eventSourceARN": "arn:aws:kinesis:us-east-1:901416387788:stream/myapp-staging-Kinesis-L6MUKT1VH451",
      "eventSource": "aws:kinesis",
      "awsRegion": "us-east-1"
    }
  ]
}

See Also

License

Apache 2.0 © 2015 Convox, Inc.

About

Send Kinesis events to Papertrail with a Lambda function.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0