Aggregation functions and alerting


I am using Loki as datasource for nginx logs of my application. I’m trying to catch when http status code is 503 or 304 to fire alert to alertmanager and to send email from alertmanager.
I’ve added alertmanager as notification channel and wrote alert to matching query but it doesn’t work as expected.

This is my query count_over_time({filename="/var/log/access.log", job="nginx"} |="503" [1m])

Aggregation function is used because otherwise I couldn’t get alert. (from my understanding).

Here is screenshot of alert: