Grafana
Use Grafana to investigate logs, alerts, and dashboards in your Grafana instance with read-only queries.
Before you start
Section titled “Before you start”Open Customize → Plugins and select this plugin. Add installs an available package; Uninstall means it is already installed. Your deployment and administrator policy determine availability.
Choose Connect Grafana and enter your Grafana address and a token for a read-only service account. Each connection is one Grafana instance, often one environment; give it a label so you can tell connections apart. Redbelt checks the address and token before saving them.
Enable the plugin for the selected agent or task. See agent setup.
Investigate errors
Section titled “Investigate errors”Redbelt starts with an overview of your Loki data sources, their labels, dashboards, and firing alerts. It counts errors before it reads log lines, then reads a narrow slice around a spike, and widens only when that is not enough. When a dashboard already answers the question, Redbelt reads its panels instead of writing its own query.
Using the production Grafana connection, find which apps logged the most errors in the last 6 hours, show me when the errors peaked, and summarize the log lines behind the biggest spike.
Queries cover at most 24 hours. Redbelt reports what the logs show and labels any root cause as a hypothesis unless the lines confirm it. This plugin cannot change Grafana.
Tool Reference
Section titled “Tool Reference”Thread and workflow availability are listed separately. A tool must also be enabled for your task and allowed by its account and administrator policy.
Available Tools
Section titled “Available Tools”| Tool | Required Fields | Thread | Workflow |
|---|---|---|---|
grafana.discover |
resource |
Yes | Yes |
grafana.query_log_metrics |
datasource_uid, logql |
Yes | Yes |
grafana.query_logs |
datasource_uid, logql |
Yes | Yes |
grafana.query_panel |
dashboard_uid, panel_ids |
Yes | Yes |
Required fields above are the schema minimum. The target, selected operation, or account can impose additional requirements.
grafana.discover — List read-only Grafana metadata.
Optional fields: dashboard_uid, datasource_uid, label, limit, query.
grafana.query_log_metrics — Count or rate log lines with a LogQL metric query, such as sum by (app) (count_over_time({level=“ERROR”, namespace=“app”}[5m])).
Optional fields: end, instant, since, start, step.
grafana.query_logs — Read log lines from a Loki data source with a LogQL log query, such as {namespace=“app”, level=“ERROR”} |= “timeout”.
Optional fields: direction, end, limit, since, start.
grafana.query_panel — Run the Loki queries behind one or more panels of a Grafana dashboard, such as an error overview’s totals, by-app table, and recent-errors log panel, over a chosen window, the way the dashboard would.
Optional fields: end, limit, since, start, variables.
Troubleshoot
Section titled “Troubleshoot”If connecting fails, check that the address is the Grafana base URL, such as https://grafana.example.com, and that the token belongs to a service account that can read the data sources.
Provider details: Grafana documentation.