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

Any way to force logs flush apart from INVOKE and SHUTDOWN? #76

Closed j-adamczyk closed 2 years ago

j-adamczyk commented 2 years ago

I tried using this extension to capture logs in Python. The problem is, when Lambda lasts less than a second, I only get messages from extension after about 5 minutes. This renders this essentially unusable, as this is nowhere near real-time logging. Is this normal? How can I fix this?

j-adamczyk commented 2 years ago

I understand now what is happening, this is exactly this issue, i.e. I receive logs on shutdown, so for logs for a single event I have to wait until underlying container is killed.

Therefore I change my question: is there any way to force logs flush / another event apart from INVOKE and SHUTDOWN that I can listen to?

j-adamczyk commented 2 years ago

I finally fixed this with sleep(5), like in this issue. Ugly, weird, but it works.