I am trying to get the log from the cloudwatch
my source code is like this below
I can find the group_name in cloudwatch console /aws/lambda/mylambda
logGroupName = "/aws/lambda/mylambda"
response = logs.describe_log_streams(
logGroupName=group_name,
logStreamNamePrefix=log_stream_name_prefix,
orderBy='LogStreamName',
descending=True,
)
however, example my log_stream_name is changed like this below.
2023/05/01/[$LATEST]e6a2f85f7eb74aa9bde07837fc971df7
2023/04/30/[$LATEST]39b7ffa511434a65ba4bb4bd915485fd
2023/04/29/[$LATEST]3c2c75965ef2422f86b1624ef042d54b
What should I set for log_stream_name_prefix?
It is asking for the prefix (the first part of the name) not the full name. So for example to query all log streams for the day of
2023/04/29the log stream prefix would be:2023/04/29/[$LATEST]