This tutorial demonstrates how to set up and install the Coralogix AWS Lambda Telemetry Exporter.
This integration is one of two options – complete and basic – for monitoring Lambda, a requirement our cutting-edge Serverless Monitoring feature.
The Coralogix AWS Lambda Telemetry Exporter is an AWS Lambda extension that uses AWS Lambda Telemetry API and seamlessly collects Lambda function logs, as well as Lambda platform logs, metrics, and traces. It is currently available as an open beta.
The Coralogix AWS Lambda Telemetry Exporter supersedes the previously offered Coralogix Extension for AWS Lambda (version 1.x.y) by extending its capabilities beyond logs. If you’re already using the Coralogix Extension for AWS Lambda, you can use it for now or migrate to the Telemetry Exporter to enjoy the new goodies early. We recommend using the Telemetry Exporter in new deployments.
This document assumes version 0.5.1 (layer version 21) of the Coralogix AWS Lambda Telemetry Exporter. If you’re using an older version, we highly recommend updating.
In order to monitor AWS Lambda functions using Coralogix follow these steps. Each of the steps is described in it’s own document.
STEP 1. Set up Coralogix AWS Resource Metadata Collection
STEP 2a. To get full telemetry, including tracing, set up the AWS Lambda Auto-Instrumentation. This is available for Node.js and Python (3.8 or newer). For other runtimes choose Step 2b.
STEP 2b. Alternatively, to get logs and basic telemetry, set up just the Coralogix AWS Lambda Telemetry Exporter
STEP 3. Learn what the Serverless Monitoring feature has to offer.
The document you’re viewing now is for Step 2b. You may want to proceed with Step 2a instead.
The Coralogix AWS Lambda Telemetry Exporter is available with any of the following:
To deploy or update the Coralogix AWS Lambda Telemetry Exporter, select the ARN corresponding to your AWS region and CPU architecture from the following list:
arn:aws:lambda:ap-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:eu-north-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-north-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:eu-west-3:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-west-3:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:eu-west-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-west-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:eu-west-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-west-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-northeast-3:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-northeast-3:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-northeast-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-northeast-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-northeast-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-northeast-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ca-central-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ca-central-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:sa-east-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:sa-east-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-southeast-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-southeast-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-southeast-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-southeast-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:eu-central-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-central-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:us-east-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:us-east-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:us-east-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:us-east-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:us-west-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:us-west-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:us-west-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:us-west-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:af-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:af-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-east-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-east-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-southeast-3:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-southeast-3:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:eu-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:me-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:me-south-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-arm64:21 arn:aws:lambda:ap-south-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:ap-southeast-4:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-central-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:eu-south-2:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:me-central-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21 arn:aws:lambda:il-central-1:625240141681:layer:coralogix-aws-lambda-telemetry-exporter-x86_64:21
STEP 1. Configure the coralogix-aws-lambda-telemetry-exporter
.
STEP 2. Add the Telemetry Exporter layer to the chosen function.
Notes:
coralogix-lambda-extension
, we suggest removing it: Layers > Edit > Select the Lambda layer > RemoveTo deploy your lambda as a container image and inject an extension as part of your function, build from the exporter image found here.
FROM coralogixrepo/coralogix-aws-lambda-telemetry-exporter:0.5.1 AS coralogix-extension FROM public.ecr.aws/lambda/python:3.8 # Layer code WORKDIR /opt COPY --from=coralogix-extension /opt/ . # Function code WORKDIR /var/task COPY app.py . CMD ["app.lambda_handler"]
In this example, python3.8 is being used as the runtime, but all runtimes are supported with our lambda extension.
Notes:
coralogix-aws-lambda-telemetry-exporter
image; you must specify the version explicitly. LOW_OVERHEAD
, REPORT_AFTER_INVOCATION
and REPORT_DURING_AND_AFTER_INVOCATION
. For info on how to choose the optimal strategy for your Lambda function, see Reporting Strategies section below.LOW_OVERHEAD
> 10000REPORT_AFTER_INVOCATION
> 25REPORT_DURING_AND_AFTER_INVOCATION
> 2000true
. Set to false to exclude the cx_metadata
from logs in order to reduce their size.true
. Set to false to disable the OTLP server and free up the 4317
and 4318
ports.true
disables metrics and tracing.structured
. Acceptable values are:
disabled
– no logs will be delivered to coralogixstructured
– logs will be wrapped in a JSON and delivered to coralogixplatform_report
. Acceptable values are:
disabled
– no metrics will be delivered to coralogixplatform_report
– metrics based on AWS Telemetry API Platform Report event will be delivered to coralogixtelemetry_api
. Acceptable values are:
disabled
– no traces will be delivered to coralogixtelemetry_api
– will generate spans basing on data provided by the AWS Lambda Telemetry API.otel
– will expect to receive spans from the function via OTLP. This mode is meant to be used in conjunction with OTEL instrumentation of the function and the CX_OTLP_SERVER_ENABLED enabled. Warning: otel
tracing mode delays emitting logs until the end of the invocation even when reporting strategy is set to REPORT_DURING_AND_AFTER_INVOCATION
.all
. Acceptable values are:
all
– all traces are sent to coralogixfollow_xray
– the telemetry exporter will respect AWS XRay’s decision which traces should be sampledfalse
. Setting it to true
will enable enrichment of the telemetry with the tags of the Lambda function. See Enrichment with tags section to learn how to correctly set this up.Due to the serverless nature of AWS Lambda and Lambda extensions, the telemetry-exporter
cannot freely do its job after and between invocations of the monitored Lambda function. A tradeoff has to be made between timely delivery of the telemetry and keeping overhead costs low.
The optimal strategy choice depends on how often the Lambda function is invoked and how long it runs. The coralogix-aws-lambda-telemetry-exporter
offers three reporting strategies that enable you to adjust reporting to the characteristics of your function.
LOW_OVERHEAD
: Recommended for frequently called functions. Telemetry is batched across many invocations of the function, and the telemetry-exporter
avoids keeping the Lambda execution environment active after an invocation is complete (and in turn avoids additional billable time to the invocations). This may result in long delays (in the order of minutes) in the delivery of telemetry.REPORT_AFTER_INVOCATION
: Recommended for rarely called functions with short to moderate execution times. Telemetry is reported at the end of each invocation, limiting the amount of billable time for each invocation.REPORT_DURING_AND_AFTER_INVOCATION
: Recommended for rarely called functions with long execution times (15s or more). Telemetry is reported in regular intervals during the execution of the function and then after the execution completes. This strategy will add 2-3s of billable time to each invocation.Notes:
Check out our tutorial here.
Coralogix AWS Lambda Telemetry Exporter can read the tags of the AWS Lambda function and add them to all reported telemetry (logs/metrics/traces). This feature is disabled by default and can be enabled with CX_TAGS_ENABLED
, but it requires prior configuration of permissions for the Lambda function. The configuration can be done in the following steps:
STEP 1. In AWS Console access the Lambda function that you would like to configure and navigate to: Configuration > Permissions
STEP 2. Click on the name of the execution role. This will bring to the IAM configuration of that role.
STEP 3. Click Add Permissions > Create Inline Policy
STEP 4. Switch to JSON
view and paste the following policy JSON:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "lambda:GetFunction", "Resource": "<paste lambda ARN here>" } ] }
STEP 5. Replace the <paste lambda ARN here>
with the ARN of the Lambda function. (you can find it on main page of the function’s configuration)
STEP 6. Click Review Policy
STEP 7. Name the policy, for example ListLambdaTags
.
STEP 8. Click Create Policy.
STEP 9. Set the CX_TAGS_ENABLED
environment variable to true
.
The Coralogix AWS Lambda Telemetry Exporter can send telemetry to Coralogix over AWS Private Link by implementing the following steps:
STEP 1. Set up PrivateLink for your VPC.
STEP 2. Configure the lambda function to run in that VPC.
STEP 3. Change the CX_DOMAIN
environment variable, by adding private.
at the beginning. For example, if your CX_DOMAIN
used to be coralogix.com
, now it should appear as private.coralogix.com
.
The Coralogix AWS Lambda Telemetry Exporter Lambda layers are signed with arn:aws:signer:eu-west-1:625240141681:/signing-profiles/coralogix_lambda
AWS Signer profile. You may need to add this profile to your code signing configuration if you have configured Lambda to require signed code.
💡 Version 0.4.x (or newer) uses different operation, and therefore requires different permissions to obtain tags. If you’ve configured the lambda:ListTags
for version 0.3.x, you should change it to lambda:GetFunction
when upgrading to 0.4.x.
💡 Version 0.4.x (or newer) uses different default value for CX_TAG_CACHE_VALIDITY_MS
. Previously the default was 60000
(1 minute); now it’s 300000
(5 minutes).
💡 Version 0.3.x (or newer) accepts environment variables starting CX_
or CORALOGIX_
prefixes. We recommend using the CX_
prefix to reduce the size of environment variables. This may be significant as AWS puts a 4kB limit on the total size of environment variables of a function.
💡 Version 0.3.x (or newer) reports response latency/duration as tags (attributes) of the invocation span instead of reporting it as independent spans. This change has been made to declutter the trace.
💡 Version 0.2.x (or newer) introduces changes in log structure. You may need to adjust your queries, filters or parsing rules to work with the new log structure.
STEP 1. Look up the latest layer version by the reviewing the list of ARNs presented earlier. The number at the end of the ARN is the layer version.
STEP 2. Change the Telemetry Exporter layer version used by the function: Layers > Edit > Change to the updated layer version > Save
STEP 1. Deploy the Coralogix-AWS-Lambda-Telemetry-Exporter in your AWS Serverless Application Repository. You are required to deploy it in the same account and region as your Lambda function.
STEP 2. Verify the deployment by clicking on ‘Layers’ in the left-hand menu. You should see that the two previously deployed Lambda layers have new versions. Keep in mind that the version number of the Lambda layer is simply incremented with each deployment and does not correspond to the semantic version shown in the AWS Serverless repository.
STEP 3. Change the Telemetry Exporter layer version used by the function: Layers > Edit > Change to latest available layer version > Save
Documentation | AWS Lambda Auto Instrumentation Severless Monitoring |
Need help?
Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.
Feel free to reach out to us via our in-app chat or by sending us an email at [email protected].