Skip to main content

Using Explore Mode

1. Opening Explore View

Method Description Notes
Dashboard Explore Click the Explore button in the dashboard header. Opens the Explore view for the current dashboard's data sources.
Global Explore Click the Explore icon in the left sidebar. Opens the Explore view for all data sources available in Grafana.
URL Navigation Navigate to /explore endpoint. Directly opens the Explore view with default data source context.

Example: Opening Explore View via URL

http://localhost:3000/explore
Note: The Explore view is available in Grafana v9.0 and later.

2. Selecting Data Source

Property Description Values
data source Specifies the data source to query prometheus, loki, influxdb, mysql, postgres
query editor Interface for writing queries promql, logql, influxql, mysql, postgres

Example: Selecting Prometheus Data Source

datasource:
  name: "prometheus"
  type: "prometheus"
  uid: "prometheus-uid"
Note: Ensure the data source is properly configured in Grafana before using it in Explore mode.

3. Running Ad-Hoc Queries

Property Value Description
query rate(node_cpu_seconds_total{job="node"}[5m]) Example Prometheus query to calculate CPU usage rate
interval 1m Time interval for query execution
datasource Prometheus Selected data source for the query

Example: Running a Simple Ad-Hoc Query

rate(node_cpu_seconds_total{job="node"}[5m])

Example: Using Variables in Queries

sum by (instance) (rate(node_cpu_seconds_total{job="$job"}[5m]))
Note: Ad-hoc queries are useful for quick analysis and debugging without creating permanent dashboard panels.
Warning: Complex queries may impact performance; use with caution in production environments.

4. Using Query History

Field Description Values
query The SQL or PromQL query string rate(http_requests_total[5m])
timeRange Time range for the query last 1h
datasource DataSource used for the query prometheus

Example: Query History Entry

{
  "query": "rate(http_requests_total[5m])",
  "timeRange": "last 1h",
  "datasource": "prometheus",
  "timestamp": "2025-04-05T10:00:00Z"
}
Note: Query history is stored locally in the browser and can be cleared from the Explore view settings.

5. Setting Time Range

Option Values Description
Time Range last 1 hour, last 6 hours, last 12 hours, last 24 hours, last 7 days, last 30 days, last 90 days, last 1 year Predefined time ranges to filter data in Explore mode
Custom Time Range 2024-01-01 00:00:00 to 2024-01-02 00:00:00 Manually set start and end times for data filtering
Relative Time Range now-1h, now-6h, now-24h Use relative time expressions to define dynamic ranges

Example: Setting Custom Time Range

Time Range: 2024-01-01 00:00:00 to 2024-01-02 00:00:00

Example: Using Relative Time Range

Time Range: now-1h to now
Note: The Explore mode supports both absolute and relative time formats. Relative times are useful for real-time dashboards.

6. Using Log Context

Example: Setting up log context in Explore

{
  "query": "logs",
  "context": {
    "labels": [
      "job",
      "instance"
    ],
    "limit": 100
  }
}
Field Description Values
labels List of label names to include in context ["job", "instance"]
limit Maximum number of logs to return 100
Note: Log context helps filter and organize logs by relevant labels.
Warning: Setting a high limit may impact performance.

7. Using Metrics Explorer

Example: Querying a metric in Metrics Explorer

rate(node_cpu_seconds_total{mode="idle"}[5m]) * 100
Property Description Values Notes
query Expression to query metrics rate(node_cpu_seconds_total{mode="idle"}[5m]) * 100 Uses PromQL syntax
legend Template for legend labels {{instance}} - {{mode}} Supports template variables
interval Interval for query evaluation 1m Defaults to auto-calculated
Note: Metrics Explorer supports PromQL, the query language for Prometheus.
Warning: Complex queries may impact performance; use with caution in production.

Key Features of Metrics Explorer

  • Real-time metric visualization
  • PromQL query support
  • Template variable integration
  • Time range selection

8. Creating Panels from Explore

Step Description Action
1 Select data source and query in Explore Choose a data source and run a query to visualize the data
2 Open the "Create Panel" menu Click on the "Create Panel" button in the Explore view toolbar
3 Configure panel settings Select the visualization type and adjust panel options as needed
4 Save the panel to a dashboard Click "Save" and choose a dashboard or create a new one

Example: Creating a Graph Panel from Explore

{
  "datasource": "Prometheus",
  "targets": [
    {
      "expr": "up",
      "legendFormat": "{{job}}"
    }
  ],
  "panelType": "graph"
}
Note: The panel created from Explore inherits the query and visualization settings from the Explore view.

9. Using Split View

Example: Split view configuration

{
  "split": true,
  "leftPanel": {
    "targets": [
      {
        "expr": "up",
        "legendFormat": "Up"
      }
    ]
  },
  "rightPanel": {
    "targets": [
      {
        "expr": "rate(http_requests_total[5m])",
        "legendFormat": "Requests per second"
      }
    ]
  }
}
Property Description Values
split Enables or disables split view mode true / false
leftPanel Configuration for the left panel in split view Object containing targets, timeRange, etc.
rightPanel Configuration for the right panel in split view Object containing targets, timeRange, etc.
Note: Split view allows you to compare two different queries or panels side-by-side for better analysis.

Steps to enable split view

  1. Navigate to the Explore view in Grafana
  2. Select a query or panel you want to split
  3. Click on the Split View button in the toolbar
  4. Configure the left and right panels with desired queries or metrics
  5. Adjust time ranges if needed for both panels

10. Using Live Tailing

Property Description Values
live tailing Real-time log streaming from selected data sources true / false
log level filter Filter logs by severity (e.g., ERROR, WARN) INFO, WARN, ERROR
max lines Maximum number of log lines to display 100, 500, 1000

Example: Enable Live Tailing in Explore

{
  "datasource": "Loki",
  "query": "log_level=ERROR",
  "liveTail": true,
  "maxLines": 500
}
Note: Live tailing is supported for Loki, Elasticsearch, and CloudWatch logs.
Warning: Enabling live tailing on large log sets may impact performance.

11. Viewing Trace Details

Field Description Example
traceId Unique identifier for the trace 1234567890abcdef
spanId Unique identifier for a span within the trace 0987654321fedcba
serviceName Name of the service that generated the span api-server
operationName Name of the operation being traced GET /users/:id
duration Duration of the span in microseconds 125000
startTime Start time of the span in Unix timestamp format 1634567890000

Example: Trace Details in Explore Mode

{
  "traceId": "1234567890abcdef",
  "spans": [
    {
      "spanId": "0987654321fedcba",
      "serviceName": "api-server",
      "operationName": "GET /users/:id",
      "duration": 125000,
      "startTime": 1634567890000
    }
  ]
}
Note: Trace details can be viewed in the Explore mode by selecting a trace from the list of traces.

12. Using Query Inspector

Property Description Values Notes
query Current query being executed SELECT * FROM logs WHERE level = 'error' Shows raw query text
duration Time taken to execute query 125ms Helps identify slow queries
rows Number of rows returned 150 Indicates data volume
error Any error messages from query Invalid syntax near 'WHERE' Useful for debugging

Example: Inspecting a Query

SELECT timestamp, level, message
FROM logs
WHERE level = 'error'
ORDER BY timestamp DESC
LIMIT 10
Note: Query Inspector is available in Explore mode and can be accessed via the Inspect button next to the query editor.
Warning: Large datasets may cause performance issues when inspecting queries.

Query Inspector Features

  • View raw query text
  • See execution duration
  • Check row count
  • Identify errors

Was this article helpful?