Lambda only sporadically logs to cloudwatch and publishes events

0

I've seen a pattern in one of our lambdas where sometimes the lambda just doesn't log to cloudwatch or publish its events to eventbridge. The lambda seems to otherwise be executing fine--the expected changes to the database are always made--but sometimes there just aren't any associated cloudwatch logs or events. I have no idea what could be causing this so I was wondering if you guys can think of anything which would result in this behavior.

1 Answer
0

Hi, I guess that you're speaking of logs written by your own code (not those written by lambda runtime). In that case, I would create a CloudTrail track to locate all calls to CW APIs by your Lambda and see if they are all present (by comparing to the Lambda invocation unique ids).

If calls to CW match Lambda invocations, then it may be an issue with CW itself for which more investigation will be needed. Otherwise, it's the application code that may not handle CW logging properly.

Additionally, I'd sugggest to mirror the calls to CW with equivalent messages in a SQS queue to see if they match

Best,

Didier

profile pictureAWS
EXPERT
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions