Alerts with messages in time series in Amazon Managed Grafana

I know there are related questions and answers for this like this one : https://community.grafana.com/t/how-to-use-alert-message-templates-in-grafana/67537.

However, in Amazon Managed Grafan, my dashboard is a little different. It looks like this :

So, I don’t really see a way to create alert templates.

Right now, I’m using the following query to track 5xx errors for one of my lambdas :

fields @timestamp, @message, @logStream, @requestId
| filter @message like /ERROR/
| stats count(*) as Errors BY BIN(5m)

And my alerts look like this :

In the notification message,I just get the message : 5xx error occured. along with the number of errors example 1,2,3 etc.

I’ve tried anything and everything like :

Errors : {{ .labels }}. {$labels} ${label} {{ $labels }} {{ $labels.alertname }} {{ $labels.cluster }} {{ $labels.Errors }}  ${labels.cluster } ${labels.Errors }
Errors : {{ .Labels }}. {$Labels} ${Label} {{ $Labels }}
Errors : {{ .Labels.alertname }}. {$Labels.alertname} ${Label.alertname} {{ $Labels.alertname }}

But these get printed directly on the notification without getting resolved to some actual value.

I would be happy to detect errors from table view as well but Amazon Managed Grafana only lets me set up alerts on Time series.

What could be done to get this fixed? I just want the message to get printed with the alert.

@mamakancha it looks like you’re using an older version of grafana with legacy alerts, is that correct?

Here’s a link to the docs for the older version I think you’re using: