Send AWS Lambda logs to Axiom
AWS Lambda is a computing service that runs code in response to events and automatically manages the computing resources required by that code.
We built an easy way to send logs and platform events of your Lambda function to Axiom that provides you with quick filters and a dashboard. With the Axiom Lambda extension, you can forget about the extra configuration of CloudWatch and subscription filters.
- Create an account on AWS Cloud;
- Sign up or log in to your account on Axiom Cloud;
- In Axiom UI, create a dataset and an API Token with ingest permissions for that dataset.
Axiom Lambda extension is available opensource on GitHub.
You can install and configure it by using one of these methods:
Configure the Axiom Lambda Extension using AWS CLI
To set up the extension via the AWS CLI, follow the instructions below:
- Add the extension as a layer with the AWS CLI:
aws lambda update-function-configuration --function-name my-function \ --layers arn:aws:lambda:<AWS_REGION>:694952825951:layer:axiom-extension-<ARCH>:<VERSION>
Add a Lambda function layer
To configure the extension via the AWS Lambda function UI, follow the instructions below:
Lambda layers contain dependencies that you can use with your Lambda functions.
- Navigate to your AWS Lambda development environment -> the Layers section and click Add a layer:
- On the Choose a layer page, check the Specify an ARN box and specify your ARN (Amazon Resource Name) as shown in the example below:
AWS_REGION: Specify the AWS Region to send the request to. For more detail, refer to the All Lambda Layers table in the Axiom Lambda Extension Readme.
ARCH: Specify the system architecture type. For more detail, refer to the All Lambda Layers table in the Axiom Lambda Extension Readme.
VERSION: Specify the latest version number mentioned on the Releases page. For example,
Click Verify: Several fields with additional information will appear under the ARN line.
Click Add: A new layer is now added to your Lambda function.
Add environment variables
Add your dataset name and an API token to the list of environment variables:
- In your AWS Lambda function UI, navigate to Configuration -> Environment variables and click Edit:
- On the Edit environment variables page, click Add environment variable to specify your dataset name and an API token:
- Click Save to add the variables.
Now when the Axiom Lambda extension is hooked up, navigate back to the Axiom UI and see the logs coming directly from your Lambda function!
Disable CloudWatch logging
After the Axiom Lambda extension is installed, the Lambda service will still send logs to CloudWatch Logs since AWS automatically creates an access role for this by default. We recommend that you install the Axiom Lambda extension first, then make sure it is working properly in Axiom, and after that remove the access role for CloudWatch.
To disable CloudWatch logging, deny the Lambda function access to CloudWatch by editing the permissions:
In your AWS Lambda function UI, navigate to Configuration -> Permissions;
In the Execution role section, click the role related to CloudWatch Logs;
On the opened Permissions tab, select the role and click Remove to deny access to CloudWatch Logs.