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

Setup

  1. Install the Axiom Lambda extension.
  2. Ensure everything works properly in Axiom.
  3. 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

1

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
  • 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.
2

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.

AXIOM_TOKEN: API_TOKEN
AXIOM_DATASET: DATASET_NAME
  • 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

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

1

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.

arn:aws:lambda:AWS_REGION:694952825951:layer:axiom-extension-ARCH:VERSION
  • 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.
2

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.

AXIOM_TOKEN: API_TOKEN
AXIOM_DATASET: DATASET_NAME
  • 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:

  1. In the AWS Lambda function UI, go to Configuration > Permissions.
  2. In the Execution role section, click the role related to Amazon CloudWatch Logs.
  3. 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.