This serverless app publishes AWS CloudWatch logs to Slack based on a subscription filter.
- Create an AWS account if you do not already have one and login
- Go to the app's page on the Serverless Application Repository and click "Deploy"
- Provide the required app parameters (see parameter details below) and click "Deploy"
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
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}
).
CloudWatch logs allow you to filter logs based on a pattern. For more information, see the AWS Documentation.
SlackUrl
(required) - Webhook URL for integration with SlackLogGroupName
(required) - Log group to listen to (has to be in same account and region)FilterPattern
(optional) - Pattern for filtering log events. Default: ERROROnlySendLogMessage
(optional) - Option to only send log message instead of all message, id, and timestamp information. Default: False. Values: False, TrueLogLevel
(optional) - Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc. Default: INFO
LogsToLambdaName
- Log Lambda Function NameLogsToLambdaArn
- Log Lambda Function ARNLambdaToSlackName
- Slack Lambda Function NameLambdaToSlackArn
- Slack Lambda Function ARN
This code is made available under the MIT license. See the LICENSE file.
If you would like to see a version of this application that uses code instead of other applications, see the 0.0.1 Release.