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.
- Under Applications, type
newrelic
in the search bar, and click the Show apps that create custom IAM roles or resource policies check-box to findnewrelic-aws-otel-log-ingestion
. - Open the
newrelic-aws-otel-log-ingestion
details and click Deploy. - In the function's Configure menu, go to Environment Variables and configure log forwarding using the following environment variables:
Key | Default value | Options | Description |
---|---|---|---|
| true |
| Determines if logs are forwarded to the New Relic UI |
| false |
| A Boolean to determine if you want to output debug messages in the CloudWatch console. |
| 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:
- From the left side menu, select Functions.
- Find and select the previously created
newrelic-aws-otel-log-ingestion
function. - Under Triggers, click Add Triggers, and select CloudWatch Logs from the dropdown.
- Select the the appropriate Log group for your application.
- Enter a name for your filter.
- Optional: Enter a filter pattern.
- Check the Enable trigger checkbox, then click Add to create the trigger.
Advertencia
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.