Introduction
Grafana Explore is an ad-hoc query interface for investigating data without creating dashboards. It supports Prometheus, Loki, Elasticsearch, and other datasources for log and metric exploration. Explore mode errors can prevent you from querying data, cause rendering failures, or result in incomplete query results. These issues often stem from datasource configuration, query syntax, or Explore-specific settings.
Symptoms
- Explore page shows "Failed to query datasource"
- Query returns "No data" despite data existing
- Explore renders incorrectly or shows blank results
- Split view fails to load second datasource
- Error: "Query timeout" or "Request too large"
- Logs in Explore show truncated results
- Query history or saved queries don't load
Common Causes
- Datasource configuration is incorrect or connection is down
- Query syntax doesn't match datasource type
- Query time range or step causes timeout
- Query returns too much data exceeding limits
- Explore mode datasource permissions are insufficient
- Browser JavaScript errors prevent rendering
- Datasource proxy configuration is wrong
Step-by-Step Fix
Datasource Connectivity
- 1.Test datasource connectivity:
- 2.```bash
- 3.# For Prometheus
- 4.curl -s "http://prometheus:9090/api/v1/query?query=up"
# For Loki curl -s "http://loki:3100/loki/api/v1/labels" ```
- 1.Verify datasource through Grafana proxy:
- 2.```bash
- 3.curl -s -u admin:password http://localhost:3000/api/datasources/proxy/1/api/v1/query?query=up
- 4.
` - 5.Check datasource health in Grafana:
- 6.- Navigate to Configuration > Data sources
- 7.- Click datasource
- 8.- Click "Test" button
- 9.- Verify "Data source is working" message
Query Syntax Issues
- 1.Fix Prometheus query syntax:
- 2.```promql
- 3.# Common syntax errors
# Wrong: missing aggregation for multi-series http_requests_total
# Correct: use aggregation sum by (job) (http_requests_total)
# Wrong: invalid label matcher http_requests_total{job==prometheus}
# Correct: use = or =~ http_requests_total{job="prometheus"} ```
- 1.Fix Loki log query syntax:
- 2.```logql
- 3.# Simple log query
- 4.{job="nginx"}
# Log query with regex filter {job="nginx"} |= "error"
# Metric query from logs sum(rate({job="nginx"}[5m])) ```
- 1.Verify query returns data:
- 2.```bash
- 3.# Test query directly
- 4.curl -s "http://prometheus:9090/api/v1/query?query=rate(http_requests_total[5m])"
- 5.
`
Timeout and Data Limits
- 1.Increase query timeout for large queries:
- 2.```ini
- 3.# In grafana.ini
- 4.[datasource]
- 5.timeout = 60
[explore] max_queries = 20 ```
- 1.Reduce query time range:
- 2.- Use shorter time range (e.g., "Last 15 minutes" instead of "Last 24 hours")
- 3.- Increase query step to reduce resolution
- 4.Fix Loki query limits:
- 5.```bash
- 6.# Loki has default limit of 1000 log lines
- 7.# Add limit parameter
- 8.curl -s "http://loki:3100/loki/api/v1/query_range?query={job='nginx'}&limit=5000"
- 9.
` - 10.Configure Loki response limits:
- 11.```yaml
- 12.# In loki.yaml
- 13.limits_config:
- 14.max_entries_limit_per_query: 10000
- 15.max_query_length: 721h
- 16.
`
Explore Rendering Issues
- 1.Check browser console for JavaScript errors:
- 2.- Open browser developer tools (F12)
- 3.- Check Console tab for errors
- 4.- Look for errors related to Explore rendering
- 5.Clear browser cache and refresh:
- 6.- Ctrl+Shift+Delete to clear cache
- 7.- Hard refresh (Ctrl+F5)
- 8.Check Grafana server logs:
- 9.```bash
- 10.journalctl -u grafana-server | grep -i "explore|query"
- 11.
`
Split View Issues
- 1.Verify both datasources are configured:
- 2.- Split view requires at least two datasources
- 3.- Check Configuration > Data sources for available datasources
- 4.Test split view datasources individually:
- 5.- Use single Explore mode for each datasource
- 6.- Verify both work independently before split view
- 7.Fix split view configuration:
- 8.```ini
- 9.# In grafana.ini
- 10.[explore]
- 11.enabled = true
- 12.
`
Datasource Proxy Issues
- 1.Check datasource proxy settings:
- 2.```ini
- 3.[database]
- 4.# Direct access
- 5.access = direct
# Proxy through Grafana access = proxy ```
- 1.Test direct vs proxy access:
- 2.- For direct access, browser connects directly to datasource
- 3.- For proxy, Grafana server proxies the request
- 4.- Try changing access mode in datasource settings
- 5.Configure datasource for Explore:
- 6.```yaml
- 7.# In datasource provisioning
- 8.datasources:
- 9.- name: Prometheus
- 10.type: prometheus
- 11.access: proxy
- 12.url: http://prometheus:9090
- 13.jsonData:
- 14.httpMode: POST
- 15.keepCookies: []
- 16.
`
Query History Issues
- 1.Check query history storage:
- 2.```bash
- 3.# Query history is stored in browser localStorage
- 4.# Clear if corrupted
- 5.# In browser console:
- 6.localStorage.removeItem('grafana.explore.queries')
- 7.
` - 8.Verify Explore settings:
- 9.```ini
- 10.[explore]
- 11.enabled = true
- 12.default_datasource = Prometheus
- 13.
`
Debug Explore Issues
- 1.Enable debug logging:
- 2.```ini
- 3.[log]
- 4.level = debug
[log.filters] explore = debug http = debug ```
- 1.Monitor Explore requests:
- 2.```bash
- 3.# Watch Grafana logs during Explore query
- 4.journalctl -u grafana-server -f
- 5.
`
Verification
- 1.Verify Explore loads correctly:
- 2.- Navigate to Explore in Grafana sidebar
- 3.- Confirm query editor appears
- 4.- Check datasource selector lists available datasources
- 5.Test query execution:
- 6.- Enter a simple query
- 7.- Verify results display in correct format
- 8.- Check graph or table renders properly
- 9.Verify split view:
- 10.- Click split view icon
- 11.- Confirm second query panel opens
- 12.- Test queries in both panels simultaneously
- 13.Test different query types:
- 14.- Metrics query (Prometheus)
- 15.- Logs query (Loki)
- 16.- Verify each type returns expected results