I'm trying to include dynamic subject into my Grafana (Grafana v9.5.0, datasource - Logstash) alerts. Goal would be to have subject similar to : "$serviceName is failing...". I was trying to achieve this with alerting labels (e.g. include label subject:serviceName} or take subject from alert annotations, description or basically anything.
So far I tried a few different template scripts:
{{ define "email.subject" }} Service is failing in SYST env - {{ .Alert.Labels }} {{ end }}
{{ define "email.subject" }} {{- range .Alerts.Labels }}{{ .Name }}={{ .Value }} {{ end }} {{- range $k, $v := .Values }} {{ $k }}={{ $v }}{{ end }} {{ end }}
None of them work as expected. Usually I get empty subject or (no Subject). I tried reading Grafana documentation, but couldn't find anything concrete for this use case.
Any help or links to more information/examples would be highly appreciated. Cheers