aws-samples / aws-lambda-extensions

A collection of sample extensions to help you get started with AWS Lambda Extensions
MIT No Attribution
445 stars 146 forks source link

Capture request id for all events. #56

Closed bhavyalatha26 closed 2 years ago

bhavyalatha26 commented 3 years ago

Hi Team,

Thank you for the samples. They were very helpful to get started.

When listening to logs from Logs API, not all logs have the equest id information within them. Only certain platform events seem to have the request id information.

Is there a way to capture request id for all events ? The lambda context usually has the request id info, is there a way to pass the lambda's context object to the extension ?

At the moment, I try to capture request id from the platform start event and add it to all messages, but the request id seems to mixup, when the collected stream of logs have logs from 2 different invocations

Regards, Bhavya.

julianwood commented 2 years ago

Hi, you'll need to use language specific loggers to add request id (which is available in context object) to your function logs. We don't modify customer logs (to add requestID) because it could mess with your log pipelines, break your parsers, etc. Once its in your function logs, you'll see it in the logs streamed by the logs API.