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.

Prerequisites

Installation

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.

  1. Navigate to your AWS Lambda development environment -> the Layers section and click Add a layer:

Add new layer

  1. 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:

arn:aws:lambda:<AWS_REGION>:694952825951:layer:axiom-extension-<ARCH>:<VERSION>

  • 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, 3.
  1. Click Verify: Several fields with additional information will appear under the ARN line.

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

  1. In your AWS Lambda function UI, navigate to Configuration -> Environment variables and click Edit:

Add environment variables

  1. On the Edit environment variables page, click Add environment variable to specify your dataset name and an API token:

Added environment variables

  1. 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:

  1. In your AWS Lambda function UI, navigate to Configuration -> Permissions;

  2. In the Execution role section, click the role related to CloudWatch Logs;

  3. On the opened Permissions tab, select the role and click Remove to deny access to CloudWatch Logs.

Disable CloudWatch logging