• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

Update Lambda monitoring

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:

重要

These update procedures apply to our serverless monitoring for AWS Lambda, and not to our infrastructure monitoring for AWS Lambda integration.

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:

    bash
    $
    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).

    bash
    $
    newrelic-lambda integrations update \
    >
    --aws-region YOUR_REGION
  3. If you do not have our logs enabled, you'll also need to update your Amazon CloudWatch log subscription filters with the following command:

    bash
    $
    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:

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

    bash
    $
    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).

    bash
    $
    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 \
    >
    --parameter-overrides Name=NRLicenseKey,Value=<YOUR_NR_LICENSE_KEY> \
    >
    --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:

    bash
    $
    aws cloudformation execute-change-set --change-set-name YOUR_CHANGE_SET_ARN

Enabling log management

If you currently don't have New Relic's enabled, but would like to:

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

    bash
    $
    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).

    bash
    $
    newrelic-lambda integrations update \
    >
    --enable-logs \
    >
    --aws-region YOUR_REGION
  3. Then do either of the following:

    • Update your Amazon CloudWatch log subscription filters for each region with the following command:

      bash
      $
      newrelic-lambda subscriptions install \
      >
      --function installed \
      >
      --filter-pattern "" \
      >
      --aws-region YOUR_REGION
    • Or, you can send function logs to New Relic directly, bypassing CloudWatch and the newrelic-log-ingestion Lambda. To do this, set the environment variable NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS=true in your Lambda function configuration.

      After that, be sure to remove any existing New Relic log subscriptions for that function using this command:

      bash
      $
      newrelic-lambda subscriptions uninstall \
      >
      --function FUNCTION_NAME \
      >
      --aws-region YOUR_REGION

      If the log subscription is present while the extension is sending logs, logs will be sent twice, resulting in duplicate log records in New Relic.

      Optionally, if you'd like to avoid Amazon's charges for CloudWatch Log ingestion, you can also modify your function's execution role so that it doesn't grant the CloudWatch Log permissions. This will prevent your function from logging to CloudWatch.

      注意

      CloudWatch Logs ingest fees can be considerable, but this step should be taken with caution. Make sure your New Relic log ingestion integration is working well and meeting your needs before disabling CloudWatch logs.

Copyright © 2024 New Relic株式会社。

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