I have an alert rule query against Loki like:
sum(count_over_time({unit=“auditd-log-alerts.service”} | logfmt | error = “” and level_code <= 3 [10s])) by (_id, type, desc, uid, path).
But Grafaana alert manager is sending one alert for many time series. With the default template I get an alert like this for example:
…
Value: [ metric=‘{_id=“132389”, desc=“Unauthorized access attempts to files (unsuccessful)”, path=“/dev/tty0”, type=“SYSCALL”, uid=“1000”}’ labels={_id=132389, desc=Unauthorized access attempts to files (unsuccessful), path=/dev/tty0, type=SYSCALL, uid=1000} value=1 ], [ metric=‘{_id=“132391”, desc=“Unauthorized access attempts to files (unsuccessful)”, path=“/dev/tty0”, type=“SYSCALL”, uid=“1000”}’ labels={_id=132391, desc=Unauthorized access attempts to files (unsuccessful), path=/dev/tty0, type=SYSCALL, uid=1000} value=1 ], [ metric=‘{_id=“132392”, desc=“Unauthorized access attempts to files (unsuccessful)”, path=“/dev/console”, type=“SYSCALL”, uid=“1000”}’ labels={_id=132392, desc=Unauthorized access attempts to files (unsuccessful), path=/dev/console, type=SYSCALL, uid=1000} value=1 ], [ metric=‘{_id=“132393”, desc=“Unauthorized access attempts to files (unsuccessful)”, path=“/dev/console”, type=“SYSCALL”, uid=“1000”}’ labels={_id=132393, desc=Unauthorized access attempts to files (unsuccessful), path=/dev/console, type=SYSCALL, uid=1000} value=1 ], [ metric=‘{_id=“132394”, desc=“Unauthorized access attempts to files (unsuccessful)”, path=“/dev/console”, type=“SYSCALL”, uid=“1000”}’ labels={_id=132394, desc=Unauthorized access attempts to files (unsuccessful), path=/dev/console, type=SYSCALL, uid=1000} value=1 ]
…
The Value is very hard to read. I actually want one alert per series that is firing. How can I make Grafana send one alert for every timeseries that is firing?
Note there is a section in the grafana alerting docs that says:
“… select Classic condition to create a single alert rule, or choose from Math, Reduce, Resample options to generate separate alert for each series.”
But none of Reduce, Math, or Resample seem to achieve state outcome of “separate alert for each series”. Reduce by definition, reduce many series to one, Math is just a more general form of classic, Resample isn’t explained but I couldn’t get anything out of it.