I'm creating a panel to show the error count in logs for canary instances. First, I need to find whether the instance is canary or not. So, if the instance is canary then I have to show the error log count for that instance.
To filter the canary instance - I have stack label so if the stack contains one instance then it should be a canary instance.
The expression should check the instance count of each and every stack, if a stack has one instance then it needs to search for the keyword in the log.
How do achieve this? I am looking for an expression something like below.
sum(count_over_time({component="stack-blue.*" ,cloud=~"${cloud}" ,environment=~"${environment}" ,location=~"${location}" } |= "Unable to record" [$__interval]))
and
(count(count by(hostname)(count_over_time({component="stack-blue.*",cloud=~"${cloud}" ,environment=~"${environment}" ,location=~"${location}" } [$__interval]))) == 1)