Skip to content

An application that integrates AWS CloudWatch logs and Slack

License

Notifications You must be signed in to change notification settings

chander/cw-logs-to-slack-multi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cw-logs-to-slack

This serverless app publishes AWS CloudWatch logs to Slack based on a subscription filter. This differs from Keeton Hodgson's by using a different lamda-to-slack mechanism that allows for basic text comparison to determine the webhook to use. This is useful in the case that you want to split slack data out based on different text that might appear (for example, send DEBUG output to one channel, and ERROR output to another.)

App Architecture

App Architecture

Installation Instructions

  1. Create an AWS account if you do not already have one and login
  2. Go to the app's page on the Serverless Application Repository and click "Deploy"
  3. Provide the required app parameters (see parameter details below) and click "Deploy"

Slack Url

To get a webhook URL for this application:

  • Navigate to https://api.slack.com
  • Click on the "Start Building" button
  • Give your app a name and select a workspace
  • Under "Add features and functionality" select "Incoming Webhooks"
  • Turn on "Incoming Webhooks" and click "Add New Webhook to Workspace"
  • Select the desired channel and click "Authorize"
  • Copy the generated Webhook URL

Log Group Name

You can find the name of the log group by navigating to CloudWatch logs on the AWS console. You can also pass it in as a parameter from another stack or another resource (e.g. default lambda log group names are /aws/lambda/{lambda-function-name}).

Filter Pattern

CloudWatch logs allow you to filter logs based on a pattern. For more information, see the AWS Documentation.

App Parameters

  1. SlackUrl (required) - Webhook URL for integration with Slack
  2. LogGroupName (required) - Log group to listen to (has to be in same account and region)
  3. FilterPattern (optional) - Pattern for filtering log events. Default: ERROR
  4. OnlySendLogMessage (optional) - Option to only send log message instead of all message, id, and timestamp information. Default: False. Values: False, True
  5. LogLevel (optional) - Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc. Default: INFO
  6. SlackUrl01 (optional) - Webhook URL for integration with Slack (if messages match ContainsString01)
  7. ContainsString01 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl01
  8. SlackUrl02 (optional) - Webhook URL for integration with Slack (if messages match ContainsString02)
  9. ContainsString02 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl02
  10. SlackUrl03 (optional) - Webhook URL for integration with Slack (if messages match ContainsString03)
  11. ContainsString03 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl03
  12. SlackUrl04 (optional) - Webhook URL for integration with Slack (if messages match ContainsString04)
  13. ContainsString04 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl04
  14. SlackUrl05 (optional) - Webhook URL for integration with Slack (if messages match ContainsString05)
  15. ContainsString05 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl05

App Outputs

  1. LogsToLambdaName - Log Lambda Function Name
  2. LogsToLambdaArn - Log Lambda Function ARN
  3. LambdaToSlackName - Slack Lambda Function Name
  4. LambdaToSlackArn - Slack Lambda Function ARN

License Summary

This code is made available under the MIT license. See the LICENSE file.

Releases

If you would like to see a version of this application that uses code instead of other applications, see the 0.0.1 Release.

About

An application that integrates AWS CloudWatch logs and Slack

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Makefile 100.0%