【问题标题】:How to directly transfer lambda function logs to new relic如何将 lambda 函数日志直接传输到新的 relic
【发布时间】:2022-08-23 12:13:47
【问题描述】:

我正在尝试使用此extension 将我的 lambda 函数与用于日志传输的新遗物集成。我的 serverless.yml 代码 sn-p 看起来像这样

custom:
  serverlessSsmFetch:
    API_KEY: /aws/parameter/path/to/apiKey
  newRelic:
    linkedAccount: Account Name
    accountId: XXXXXXX
    apiKey: ${self:custom.serverlessSsmFetch.API_KEY}
    enableFunctionLogs: true
    cloudWatchFilter: \"*\"

plugins:
  - serverless-python-requirements
  - serverless-newrelic-lambda-layers
  - serverless-ssm-fetch

但它会返回此警告并回退到使用 cloudwatch 进行日志传输。

Warning: Unable to find NR License key for extension validation; falling back to CloudWatch for transport.
Adding NewRelic layer to function1
Warning: Function \"function1\" already will be handled with provider.layers; skipping.
Warning: No New Relic AWS Lambda integration found for this New Relic linked account and aws account.

我检查了函数环境变量中的 apiKey,它得到了正确的密钥。

    标签: logging aws-lambda amazon-cloudwatch newrelic newrelic-platform


    【解决方案1】:

    您是否使用USER 密钥作为 API 密钥?我遇到了同样的问题,结果证明我使用了不正确的 API 密钥类型(即 Ingest - License 不正确)。

    【讨论】:

    • 那么我们需要使用 USER 密钥或 Ingest-License 密钥吗?
    【解决方案2】:

    我也在用同样的无服务器-newrelic-lambda-layers扩展名,这对我有用: - 将配置值存储在 AWS Systems Manager > Parameter Store - 通过 SLS 环境并在 serverless.ts(或 yml)中获取它,如下所示

    accountId: '${ssm:/${sls:stage}/newrelic-accountId}',
    apiKey: '${ssm:/${sls:stage}/newrelic-api-key}',
    

    【讨论】:

      猜你喜欢
      • 2020-10-08
      • 2015-01-03
      • 2020-09-27
      • 2019-09-14
      • 2021-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多