newrelic/newrelic-lambda-extension

Differentiate between logs from multiple lambdas having the same name

Closed this issue · 4 comments

Summary

When multiple lambdas having the same name are instrumented, their logs all appear in one place in the New Relic UI.

Desired Behavior

Multiple lambdas with the same name should have their logs separated in the UI.

Possible Solution

It would be nice if the logs arrived with some other differentiator besides the name, which could be used by the UI to split up the logs. Currently it seems that the AWS account ID is not decorated on the logs which are sent, and this could be one approach. (Are lambda names unique per AWS account?)

Additional context

This affects prod/qa environments where both are instrumented and the lambda has the same name across environments.

One simple way to achieve this might be to allow setting NEW_RELIC_APP_NAME to something different for each lambda (e.g. my-lambda-dev and my-lambda-prod). Unfortunately this environment variable isn't currently recognised.

NEW_RELIC_APP_NAME can be set via the environment variable of the same name.

@kolanos that doesn’t appear to be true currently. I am setting that environment variable in my dev and prod lambdas, but both are appearing in NR with the same name, and the logs are all muddled together.

@kolanos would you mind briefly explaining how this is fixed by 95f5ee4?