Skip to content

A lambda function with an AWS CloudWatch Logs subscription

License

Notifications You must be signed in to change notification settings

keetonian/cw-logs-to-lambda

Repository files navigation

cw-logs-to-lambda

This serverless app publishes AWS CloudWatch logs to another Lambda function based on a subscription filter. It does this by extracting the information from a CloudWatch log event and sending a JSON array of strings with information from the logs.

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"

Destination Function Name

Pass in a function name either as a reference parameter from another stack or resource or by supplying a name.

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. DestinationFunctionName (required) - Name of the function to which this application will send log messages
  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. LogLevel (optional) - Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc. Default: INFO

App Outputs

  1. LogsToLambdaName - Lambda function name.
  2. LogsToLambdaArn - Lambda function ARN.

License Summary

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

About

A lambda function with an AWS CloudWatch Logs subscription

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published