Better Stack AWS CloudWatch log forwarding

Start logging in 8 minutes

Forward logs from your AWS CloudWatch to Better Stack.

Create a new AWS Lambda

In AWS Console -> Lambda -> Functions -> Create function, create a new Lambda function with these settings:

  • Author from scratch
  • Function name: logtail-aws-lambda
  • Runtime: Node.js 18.x
  • Architecture: x86_64

Upload Better Stack AWS Lambda sources

Clone logtail/logtail-aws-lambda repository and build it:

Build Lambda source code
git clone https://github.com/logtail/logtail-aws-lambda.git
cd logtail-aws-lambda
npm run build

In AWS Console -> Lambda -> Functions -> logtail-aws-lambda -> Code source, select Upload from -> .zip file and upload the build/logtail-aws-lambda.zip archive.

Configure Better Stack source token

In AWS Console -> Lambda -> Functions -> logtail-aws-lambda -> Configuration, select Environment variables section, add a new variable BETTER_STACK_SOURCE_TOKEN and paste your Better Stack source token as a value.

Set up subscription filters in CloudWatch

Go to CloudWatch -> Log groups and open the group you'd like to send to Better Stack.

In Subscription filters tab, choose Create -> Create Lambda subscription filter with these settings:

  • Lambda function: logtail-aws-lambda
  • Subscription filter name: logtail-aws-lambda-filter

You should see your logs in Better Stack -> Live tail.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! 🙏