• /
  • EnglishEspañol日本語한국어Português
  • EntrarComeçar agora

Forward your Lambda function logs with New Relic and OpenTelemetry

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

  • Make sure you have a .
  • An AWS account

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.

Open the AWS Serverless Application Repository 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

is used for sending data to New Relic. Required.

Acknowledge that the app creates custom IAM roles, and then click Deploy.

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.
  7. Check the Enable trigger checkbox, then click Add to create the trigger.

Cuidado

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.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.