How to create informative Loki alert emails with full exception context in Grafana (Open Source)

Hi everyone,

We are using the open-source version of Grafana and have integrated Loki to collect application logs. Based on exceptions found in the logs, we have configured alerts using Alertmanager, and the alerts are triggering as expected.

However, the alert emails we receive are not very informative. When an alert is triggered, we still need to log in to Grafana and run additional queries to understand what actually happened.

What we are trying to achieve is an alerting setup where the email notification itself provides the full context of the exception, such as:

  • Which service was affected

  • Partner details

  • Payment method involved

  • Any other relevant metadata from the logs

Essentially, when an exception occurs, we want the alert email to tell the complete story so that we can quickly understand and act on the issue without additional manual investigation.

Could someone please guide us on:

  • How to enrich Loki alerts with more contextual information?

  • Whether this can be done using labels/annotations or alert templates in Grafana/Alertmanager?

  • Any best practices for building detailed, actionable alert notifications from logs?

Thanks in advance for your help!

In alertmanager you can use labels to form your error message. You can use any label that’s available in the query result.

That said, please provide some example logs and what you want out of it.