Grafana Alerts From Loki Logs

In order to send alerts based on queries against Loki logs, 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 365 days after the last reply. New replies are no longer allowed.