Grafana for log analysis
Grafana Labs' official server is our second pick for log analysis, and it is the right one when your logging runs on the open Grafana and Loki stack. It connects an agent to the same dashboards, datasources, and queries your team already uses, so investigating a failure becomes a conversation against live data rather than a session in a log viewer.
It ranks second of four because its strength is breadth across an open observability stack, not a dedicated log-search experience. For teams already on Grafana it is the obvious fit; Datadog, SigNoz, and Better Stack each fit a different logging home.
How Grafana fits
The work runs through the datasource and query tools. list_datasources and get_datasource locate the Loki backend, get_query_examples surfaces sample queries for that datasource type, and run_panel_query executes a panel's existing query over a custom time range to pull the log lines around an incident. The dashboard tools, search_dashboards, get_dashboard_by_uid, get_dashboard_panel_queries, give the agent the context a panel was built with, so it can reuse a known-good query instead of guessing.
Two honest limits. run_panel_query and get_query_examples are disabled by default, so log retrieval depends on enabling them. And the explicit query tool here is query_prometheus, which is PromQL for metrics, not a dedicated LogQL runner, so Loki access leans on the panel-query path. Datadog is the stronger pick when you want full APM plus log search in one vendor; SigNoz fits an OpenTelemetry-native backend; Better Stack suits a developer-friendly log service. Reach for Grafana when your logs are in Loki and you want the agent querying them next to the dashboards and metrics that explain them.
Tools you would use
| Tool | What it does |
|---|---|
| search_dashboards | Finds dashboards by title or metadata. |
| get_dashboard_by_uid | Retrieves the full details of a dashboard by UID. |
| get_dashboard_summary | Gets a compact overview of a dashboard. |
| get_dashboard_property | Extracts parts of a dashboard via a JSONPath expression. |
| get_dashboard_panel_queries | Gets the queries and datasource info for a dashboard's panels. |
| update_dashboard | Modifies or creates a dashboard. |
| patch_dashboard | Applies targeted changes to a dashboard without sending full JSON. |
| run_panel_query | Executes a dashboard panel's query over a custom time range (disabled by default). |
| list_datasources | Lists all configured datasources. |
| get_datasource | Gets a datasource by UID or name. |
FAQ
- How does the Grafana MCP server query Loki logs?
- Through its datasource and panel-query tools: list_datasources and get_datasource find the Loki backend, and run_panel_query executes a panel's query over a chosen time range. Note run_panel_query is disabled by default and must be enabled first.
- Is Grafana the best pick if I only need log search?
- Not necessarily. It is second here and strongest for teams already on the Grafana and Loki stack, where logs sit beside dashboards and metrics. For dedicated log search alone, Better Stack or Datadog may fit better.