Send data from AWS Lambda to Axiom
This page explains how to send Lambda function logs and platform events to Axiom.
Use the Axiom Lambda Extension to send logs and platform events of your Lambda function to Axiom.
Alternatively, you can use the AWS Distro for OpenTelemetry to send Lambda function logs and platform events to Axiom. For more information, see AWS Lambda Using OTel.
Axiom detects the extension and provides you with quick filters and a dashboard. For more information on how this enriches your Axiom organization, see AWS Lambda app.
To determine the best method to send data from different AWS services, see Send data from AWS to Axiom.
The Axiom Lambda Extension is an open-source project and welcomes your contributions. For more information, see the GitHub repository.
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
Setup
- Install the Axiom Lambda extension.
- Ensure everything works properly in Axiom.
- Turn off the permissions for Amazon CloudWatch.
The last step is important because after you install the Axiom Lambda extension, the Lambda service still sends logs to Amazon CloudWatch Logs. You need to manually turn off Amazon CloudWatch logging.
Installation
To install the Axiom Lambda Extension, choose one of the following methods:
Install with AWS CLI
Add the extension as a layer with the AWS CLI:
- Replace
AWS_REGION
with the AWS Region to send the request to. For example,us-west-1
. - Replace
ARCH
with the system architecture type. For example,arm64
. - Replace
VERSION
with the latest version number specified on the GitHub Releases page. For example,11
.
Add the Axiom dataset name and API token to the list of environment variables. For more information on setting environment variables, see the AWS documentation.
- Replace
API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable. - Replace
DATASET_NAME
with the name of the Axiom dataset where you want to send data.
You have installed the Axiom Lambda Extension. Go to the Axiom UI and ensure your dataset receives events properly.
Install with Terraform
Choose one of the following to install the Axiom Lambda Extension with Terraform:
- Use plain Terraform code
- Use the AWS Lambda Terraform module
You have installed the Axiom Lambda Extension. Go to the Axiom UI and ensure your dataset receives events properly.
Install with AWS Lambda function UI
Add a new layer to your Lambda function with the following ARN (Amazon Resource Name). For more information on adding layers to your function, see the AWS documentation.
- Replace
AWS_REGION
with the AWS Region to send the request to. For example,us-west-1
. - Replace
ARCH
with the system architecture type. For example,arm64
. - Replace
VERSION
with the latest version number specified on the GitHub Releases page. For example,11
.
Add the Axiom dataset name and API token to the list of environment variables. For more information on setting environment variables, see the AWS documentation.
- Replace
API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable. - Replace
DATASET_NAME
with the name of the Axiom dataset where you want to send data.
You have installed the Axiom Lambda Extension. Go to the Axiom UI and ensure your dataset receives events properly.
Turn off Amazon CloudWatch logging
After you install the Axiom Lambda extension, the Lambda service still sends logs to CloudWatch Logs. You need to manually turn off Amazon CloudWatch logging.
To turn off Amazon CloudWatch logging, deny the Lambda function access to Amazon CloudWatch by editing the permissions:
- In the AWS Lambda function UI, go to Configuration > Permissions.
- In the Execution role section, click the role related to Amazon CloudWatch Logs.
- In the Permissions tab, select the role, and then click Remove.
Troubleshooting
- Ensure the Axiom API token has permission to ingest data into the dataset.
- Check the function logs on the AWS console. The Axiom Lambda Extension logs any errors with setup or ingest.
For testing purposes, set the PANIC_ON_API_ERR
environment variable to true
. This means that the Axiom Lambda Extension crashes if it can’t connect to Axiom.
Was this page helpful?