Create a way to "filter" within a tailing log.
Similar to how we can filter in cloudwatch logs insights like this:
fields @timestamp, @message
| filter function = "myFunctionName"
| sort @timestamp desc
| limit 10000
when using logging utilities such as lambda powertools among others, the message written to cloudwatch logs can be a json object like this:
{"level":30,"time":1755966193949,"pid":1,"hostname":"ip-172-12-27-1.us-east-1.compute.internal","requestId":"48d08068-f123-4627-ad39-697423a965c0","function":"myFunctionName","method":"POST","url":"/example/path","count":3000,"startNumber":1,"endNumber":3001,"verificationPassed":true,"msg":"Successfully created and verified 3000 entries"}
-- which then lets you filter like above on one of those json entries.
The reason this is useful is because if you have lambda functions writing to cloudwatch logs, it's a 1:1 relationship between your function/controller and the log. But if you have an ECS container writing logs, you might have a whole application with many functions writing to just that one cloudwatch log. And now you need a way to just focus on the function you're troubleshooting.
Create a way to "filter" within a tailing log.
Similar to how we can filter in cloudwatch logs insights like this:
when using logging utilities such as lambda powertools among others, the message written to cloudwatch logs can be a json object like this:
{"level":30,"time":1755966193949,"pid":1,"hostname":"ip-172-12-27-1.us-east-1.compute.internal","requestId":"48d08068-f123-4627-ad39-697423a965c0","function":"myFunctionName","method":"POST","url":"/example/path","count":3000,"startNumber":1,"endNumber":3001,"verificationPassed":true,"msg":"Successfully created and verified 3000 entries"}-- which then lets you filter like above on one of those json entries.
The reason this is useful is because if you have lambda functions writing to cloudwatch logs, it's a 1:1 relationship between your function/controller and the log. But if you have an ECS container writing logs, you might have a whole application with many functions writing to just that one cloudwatch log. And now you need a way to just focus on the function you're troubleshooting.