The Logzio OpenTelemetry Collector Lambda Extension provides a mechanism to synchronously export traces from AWS Lambda applications. It does this by embedding a stripped-down version of OpenTelemetry Collector Contrib inside an AWS Extension Layer. This allows the Lambda applications to use the OpenTelemetry Collector Exporter to send traces and metrics to any configured backend, such as Logz.io.

Supported AWS regions are: us-east-1, us-east-2, ca-central-1, ap-northeast-2, ap-northeast-1, eu-central-1, eu-west-2

Install the OpenTelemetry Collector Lambda Extension to an existing Lambda function

Before you begin, you’ll need:

Install the OpenTelemetry Collector Lambda Extension to an existing Lambda function using the AWS CLI
aws lambda update-function-configuration --function-name Function --layers arn:aws:lambda:<<your-aws-region>>:486140753397:layer:logzio-opentelemetry-collector-layer:1	
Activate function tracing
aws lambda update-function-configuration --function-name Function --tracing-config Mode=Active
Configuration the function

By default, OpenTelemetry Collector Lambda Extension exports the telemetry data to the Lambda console. To customize the collector configuration, add a collector.yaml to your function and specifiy its location via the OPENTELEMETRY_COLLECTOR_CONFIG_FILE environment file. Here is a sample configuration file:

receivers:
  otlp:
    protocols:
      grpc:
      http:
exporters:
  logzio:
    account_token: <<TRACING-SHIPPING-TOKEN>>
    region: <<LOGZIO_ACCOUNT_REGION_CODE>>
service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [logzio]

Replace <<TRACING-SHIPPING-TOKEN>> with the token of the account you want to ship to.

If your account is hosted in any region other than us, replace LOGZIO_ACCOUNT_REGION_CODE> with the applicable region code. Once the file has been deployed with a Lambda, configuring the OPENTELEMETRY_COLLECTOR_CONFIG_FILE will tell the OpenTelemetry Collector Lambda Extension where to find the collector configuration: aws lambda update-function-configuration --function-name Function --environment Variables={OPENTELEMETRY_COLLECTOR_CONFIG_FILE=/var/task/collector.yaml}