Coder Social home page Coder Social logo

parana-games / lambda-errors-to-slack-sar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cplankey/lambda-errors-to-slack-sar

0.0 0.0 1.0 25 KB

Subscribes to tagged Lambdas in your account and forwards their errors to a specified Slack channel

JavaScript 100.00%

lambda-errors-to-slack-sar's Introduction

Lambda Monitoring to Slack Stack

This stack is designed to allow you to monitor your AWS Lambda errors and send alerts to a specified slack channel. There are plenty of paid services (and even some free ones) that offer the same functionality, but the largest drawback is that it requires you to send your logs to a vendor's AWS account. This solution allows you to keep the logs in your account and customize which Lambda's forward their logs to slack.

Error Types

The current implementation picks up and Lambda Error, Timeout, and any message written with console.error().

Resources

Subscriber

The subscriber lambda is invoked any time you update tags on a Lambda function. The subscriber looks for a tag named monitoring and looks for that tag value to evaluate to true. If the subscriber finds the monitoring tag is set to true then it creates a new log subscription on the updated lambda. This log subscription subscribes the Alerter lambda to the modified lambda's log group. Monitoring Tag

If the monitoring tag does not exist or is set to false, this Lambda will check if the Alerter function is subscribed to the log groups and remove the subscription if so. This allows you to toggle on and off the subscriptions as needed.

Alerter

This lambda is invoked by Cloudwatch Logs when a lambda with the monitoring tag writes logs. This lambda then parses the log event to find out if it is a function error or a console.error(). It then relays this information to a specified slack channel.

Configuring Slack Settings

At this time, this app requires you to specify a Slack Webhook URL. To generate a Slack Webhook URL, follow the Create The Slack App portion of this Medium post. Once you have a Webhook URL, you need to add it to the serverless.yml file in the alerter function's environment settings. If your Slack Webhook URL looks like this: https://hooks.slack.com/services/ABCDEF123/12345ABCDEF/XXXXYYYYXXXXYYYYXXXXYYYY then update the environment variable to look like this:

alerter:
    handler: alerter/index.main
    environment:
	    SLACK_WEBHOOK_URL: ABCDEF123/12345ABCDEF/XXXXYYYYXXXXYYYYXXXXYYYY

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.