Add a Parameter in the Alert Title

In Grafana cloud, I am running a query to extract data from the logs.
Following an example of the query that has a regex to extract all the jobs that starts with “abc” and ends with “nzvu7wpo”:
count_over_time({namespace=“data-services”, cluster=“p21d”, job=~“data-services/abc-.*-nzvu7wpo”} |~ (?i)exception | pattern <exception> [24h])

The output would include a label for “job”:
image

{ job=“…”, stream=“stderr”}

Is it possible to pass the job output value to the name of the alert, so that whenever an email alert is being thrown, the email subject would be like this:
Alert for job abc: Exception occurred

Not directly, but you can workaround this by assigning the entire log line into a label then aggregate on that label. For example (mock query, not tested):

sum by (logline) (
  count_over_time(
    {namespace=“data-services”, cluster=“p21d”, job=~“data-services/abc-.*-nzvu7wpo”}
      |~ (?i)exception
      | label_format logline="{{ __line__ }}" [24h])

Of course, you’ll want to make sure your log lines are actually identical, otherwise this will generate one alert per unique log line.