Grafana Alerts Based on Loki Logs

Not sure whether to put this in Grafana or Loki, but since it’s Grafana Alerts, I decided here.

So I know I have to create a Prometheus DataSource pointed at Loki. That works.

However, how do I query the Loki logs using a Prometheus query when my Loki logs don’t have any metrics? I’ve tagged them in several ways. Can I even create a metric in my Promtail config file? The time is there, obviously, but if it’s an default metric you get, I don’t know how to plug into it. I tried time, timestamp, and datetime as metric names hoping to get lucky, but no luck for me.

I assume there’s something obvious here I’m missing. I’m completely new to Prometheus queries, and I have only been doing basics with Promtail/Loki for a few months. Google has failed me, so please go easy on me.

Thanks in advance,
Kevin

This topic was automatically closed after 365 days. New replies are no longer allowed.