What does AWS Cloud watch Log Stream represent?

626 views Asked by At

In AWS Gateway API, if we enable logging using cloud watch settings as shown below, I see quite a few LogStreams in cloud watch. enter image description here

enter image description here

What are these streams? Cloudwatch document mentioned below

Represents a log stream, which is a sequence of log events from a single emitter of logs.

I expect only 1 stream for my API in this case. But I see multiple entries. Why do I have so many streams?

1

There are 1 answers

1
asdf On BEST ANSWER

CloudWatch generates multiple streams due to concurrent access. Only one active connection to API gateway can write to one stream at a time. So, it will generate a new stream for the blocked sessions. Then, when a new session comes up it will choose the newest log stream to write to, which in turn will cause any other concurrent new sessions to generate new streams. Unfortunately, in my experience, it appears that CloudWatch Logs does not have a buffering system in place, so it's a 1-to-1 realtime relationship between sessions and streams.