---
title: Forward your  Lambda function logs with New Relic and OpenTelemetry
source: https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/opentelemetry/otel-adot-log-ingestion-serverless
---

You can monitor AWS serverless application that sends OpenTelemetry log events data from AWS CloudWatch to the New Relic UI.
You can configure the ADOT Lambda layer collector to successfully forward your OpenTelemetry application logs with all of your service and application context.
This includes ensuring that logs contain metadata such as service name, log group name, function ARN and any other relevant attributes that can aid in observability and troubleshooting.

## Prerequisites [#Prerequisite]

-   Make sure you have a license key.
-   An AWS account

## Procedure [#procedure]

The following setup shows one approach for configuring environment variables to your AWS Lambda application. You can also configure them on the AWS functions page. For more information, [see the Amazon Lambda environment variables doc](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html).

1.  Open the [AWS Serverless Application Repository](https://serverlessrepo.aws.amazon.com/applications) in your browser, and complete the following procedure.
    1.  Under **Applications**, type `newrelic` in the search bar, and click the **Show apps that create custom IAM roles or resource policies** check-box to find `newrelic-aws-otel-log-ingestion`.
    2.  Open the `newrelic-aws-otel-log-ingestion` details and click **Deploy**.
    3.  In the function's **Configure** menu, go to **Environment Variables** and configure log forwarding using the following environment variables:
    | Key                       | Default value                                                    | Options        | Description                                                                            |
    | ------------------------- | ---------------------------------------------------------------- | -------------- | -------------------------------------------------------------------------------------- |
    | `NR_OTEL_LOGGING_ENABLED` | true                                                             | `true`,`false` | Determines if logs are forwarded to the New Relic UI                                   |
    | `DEBUG_LOGGING_ENABLED`   | false                                                            | `true`,`false` | A Boolean to determine if you want to output debug messages in the CloudWatch console. |
    | `LICENSE_KEY`             | license key is used for sending data to New Relic. **Required.** |                |                                                                                        |
2.  Acknowledge that the app creates custom IAM roles, and then click **Deploy**.
3.  Once the process in the step above completes, create a Lambda trigger to link your Lambda function to CloudWatch logs.
    To get your logs streaming to New Relic UI, attach a trigger to the Lambda in the AWS UI:
    1.  From the left side menu, select **Functions**.
    2.  Find and select the previously created `newrelic-aws-otel-log-ingestion` function.
    3.  Under **Triggers**, click **Add Triggers**, and select **CloudWatch Logs** from the dropdown.
    4.  Select the the appropriate **Log group** for your application.
    5.  Enter a name for your filter.
    6.  Optional: Enter a [filter pattern](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).
    7.  Check the **Enable trigger** checkbox, then click **Add** to create the trigger.
    > #### ⚠️ CAUTION
    >
    > On the ingestion function, ensure that you set up a trigger, not a log subscription. Setting up a subscription in the Lambda console can lead to a cascade of logs generated and forwarded to New Relic.
    **Optional: Configure different logging endpoints**
    You can set a custom logging endpoint if needed, this will allow you for example to use our FedRAMP compliant endpoints.
    For that, you should deploy the application and explained above and then:
    1.  Go to the recently deployed lambda function view in AWS.
    2.  Scroll down and click on the **Configuration** tab.
    3.  On the left menu inside the **Configuration** tab, click on **Environment Variables**.
    4.  Here you can see a list of the already existing environment variables, just click **Edit** on the top right of the **Environment Variables** table.
    5.  Update the `NR_OTEL_LOGGING_ENDPOINT` with the appropiate endpoint:
        -   `US_OTEL_LOGGING_ENDPOINT` (default): `https://otlp.nr-data.net:4318/v1/logs`
        -   `EU_OTEL_LOGGING_ENDPOINT`: `https://otlp.eu01.nr-data.net:4318/v1/logs`
        -   `JP_OTEL_LOGGING_ENDPOINT`: `https://otlp.jp.nr-data.net:4318/v1/logs`
        -   For FedRAMP: `https://gov-log-api.newrelic.com/log/v1`
    6.  Click **Save**.
