Update serverless monitoring for AWS Lambda

After enabling our monitoring for AWS Lambda, you should occasionally update our Lambda function that's used to report AWS log data: newrelic-log-ingestion.

There are two ways to do this:

Update our Lambda integration via CLI

This section describes how to update if your Lambda monitoring was enabled using our recommended CLI tool.

  1. Make sure you have the latest version of the CLI:

    pip install --upgrade newrelic-lambda-cli
    
  2. For each region in which you've installed the newrelic-log-ingestion function, run the following command, replacing YOUR_REGION with your region identifier (for example, us-west-2).
    newrelic-lambda integrations update \
        --aws-region YOUR_REGION
    
  3. If you do not have our logs enabled, you'll also need to update your AWS CloudWatch log subscription filters with the following command:

    newrelic-lambda subscriptions install \
        --function installed \
        --aws-region YOUR_REGION
    

Update Layers via CLI

This section describes how to update your function's Layer if you installed it with our CLI tool.

  1. Make sure you have the latest version of the CLI:

    pip install --upgrade newrelic-lambda-cli
    
  2. Pass the --upgrade flag to the install command:

    newrelic-lambda layers install \
        --function installed \
        --nr-account-id NR_ACCOUNT_ID \
        --upgrade
    

Update a manual Serverless Application Repository install

If you manually installed the ingest function from the AWS Serverless Application Repository (and didn't use the CLI), update using this procedure:

  1. Run the following, replacing YOUR_REGION with your region (for example, us-west-2)​.
    aws serverlessrepo create-cloud-formation-change-set \
     --application-id arn:aws:serverlessrepo:us-east-1:463657938898:applications/NewRelic-log-ingestion \
     --stack-name NewRelic-log-ingestion \
     --capabilities CAPABILITY_RESOURCE_POLICY \
     --region YOUR_REGION
    

    This command outputs several fields, one of which is the ChangeSetId: an ARN for the change set that you just created. Copy that ARN.

  2. Use the ARN in this command, which executes the change set:
    aws cloudformation execute-change-set --change-set-name YOUR_CHANGE_SET_ARN
    

Enabling our Logs

If you currently don't have our logs enabled, but would like to:

  1. Make sure you have the latest version of the CLI:

    pip install --upgrade newrelic-lambda-cli
    
  2. For each region in which you've installed the newrelic-log-ingestion function, run the following command, replacing YOUR_REGION with your region (for example, us-west-2).
    newrelic-lambda integrations update \
        --enable-logs \
        --aws-region YOUR_REGION
    
  3. Then update your AWS CloudWatch log subscription filters for each region with the following command:

    newrelic-lambda subscriptions install \
        --function installed \
        --filter-pattern "" \
        --aws-region YOUR_REGION
    

For more help

If you need more help, check out these support and learning resources: