newrelic / aws-log-ingestion

AWS Serverless Application that sends log data from CloudWatch Logs to New Relic Infrastructure - Cloud Integrations.
Apache License 2.0
52 stars 77 forks source link

Tie logs to an APM? #90

Open jamesmehorter opened 1 year ago

jamesmehorter commented 1 year ago

Hello,

Logs sent to NR via this lambda are not related to any specific APM. Is there a way for this lambda to set the appropriate entity.guid, entity.guids, and entity.name fields in the log JSON so that logs may be related/tied to a specific APM? (I believe these fields would accomplish that linking?)

(I understand using an infrastructure agent typically accomplishes this, though we have reasons for shipping logs separately)

jamesmehorter commented 1 year ago

The New Relic PHP Agent team has just released https://github.com/newrelic/newrelic-php-agent/releases/tag/v10.13.0.2 which does allow us to decorate logs being forwarded by an external solution (e.g. from cloudwatch using this lambda) with the correct entity.* attributes which will link logs to the correct APM.

jamesmehorter commented 1 year ago

This NR_TAGS env var seems it would also accomplish this linking, but would require one lambda running per application, e.g. as a sidecar container running along side the application container