Cloudwatch log insights count_distinct() set default 0 value when no logs are present

17 Views Asked by At

I'm working with Log Insights, specifically using count_distinct(), and I'm aiming to ensure that when no records are found, the result is explicitly returned as 0.

Any insights on achieving this?"

This is my query

fields @message
| filter method= "Login" AND (ispresent(accountLocked))
| stats count_distinct (userID)
0

There are 0 best solutions below