metric filters from cloudwatch logs

23 views Asked by At

I have a lambda which parses a Json and prints the following:

console.log("Execution Duration in minutes: " + timeDiff / (1000*60))

this puts logs in cloud-watch , which I then need to use for metric filters. However, I am unable to create a filter which will fetch just the number after this log and then create a metric out of it.

What filter pattern should I use here? I have tried the following:

  • {$.message="Execution Duration in minutes: %"} // This doesn't show anything
  • %Execution Duration in minutes in minutes: % // This gives 2024-03-05T21:51:19.161Z e93ea215-47a0-5436-b1ed-fc74rdgb046 INFO Execution Duration in minutes: 113.5

Not sure if this is possible or not? Also - I do have access to lambda, I can change how the values are logged and fix that as well.

0

There are 0 answers