

# Explore in Grafana version 12
<a name="v12-explore"></a>

****  
This documentation topic is designed for Grafana workspaces that support **Grafana version 12.x**.  
For Grafana workspaces that support Grafana version 10.x, see [Working in Grafana version 10](using-grafana-v10.md).  
For Grafana workspaces that support Grafana version 9.x, see [Working in Grafana version 9](using-grafana-v9.md).  
For Grafana workspaces that support Grafana version 8.x, see [Working in Grafana version 8](using-grafana-v8.md).

Grafana’s dashboard UI provides functionality to build dashboards for visualization. *Explore* strips away the dashboard and panel options so that you can focus on the query. It helps you iterate until you have a working query and then you can build a dashboard from the query.

**Note**  
If you just want to explore your data and do not want to create a dashboard, then Explore makes this much easier. If your data source supports graph and table data, then Explore shows the results both as a graph and a table. This allows you to see trends in the data and more details at the same time.

This page will get you started exploring your data. The following topics give you more details on specific features and uses for Explore.
+ [Query management in Explore](v12-explore-manage.md)
+ [Logs in Explore](v12-explore-logs.md)
+ [Tracing in Explore](v12-explore-tracing.md)
+ [Correlations editor in Explore](v12-explore-correlations.md)
+ [Inspector in Explore](v12-explore-inspector.md)

## Start exploring
<a name="v12-explore-start"></a>

**Note**  
In order to access Explore, you must have an editor or an administrator role.

**To access Explore**

1. In your Grafana workspace, choose the Explore menu item from the left menu bar.

   An empty Explore tab opens.

   Alternately, to start with an existing query in a panel, choose the Explore option from the Panel menu. This opens an Explore tab with the query from the panel and allows you to tweak or iterate in the query outside of your dashboard.

1. Choose your data source from the dropdown in the top left.

   You can also choose **Open advanced data source picker** to see more options, including adding a data source (for Admins only).

1. Write the querying using the query editor provided by the selected data source.

   For more details about queries, see [Query and transform data](v12-panels-query-xform.md).

1. Run the query using the button in the top right corner.

## Split and compare
<a name="v12-explore-compare"></a>

The split view provides an easy way to compare visualizations side-by-side or to look at related data together on one page.

**Top open the split view**

1. In the Explore view, choose the **Split** button to duplicate the current query and split the page into two side-by-side queries.
**Note**  
It is possible to select another data source for the new query which, for example, allows you to compare the same query for two different servers or to compare the staging environment to the production environment.

   In split view, timepickers for both panels can be linked (if you change one, the other gets changed as well) by selecting a time-sync button attached to one of the timepickers. Linking timepickers keeps the start and the end times of the split view queries in sync. It ensures that you’re looking at the same time interval in both split panels.

1. To close the newly created query, choose the **Close Split** button.

## Content outline
<a name="v12-explore-outline"></a>

The content outline is a side navigation bar that keeps track of the queries and visualizations you created in Explore. It allows you to navigate between them quickly.

The content outline also works in a split view. When you are in split view, the content outline is generated for each pane.

**To open the content outline**

1. Select the **Outline** button in the top left corner of the **Explore** screen.

1. Select any panel icon in the content outline to navigate to that panel.

## Share Explore URLs
<a name="v12-explore-shareurl"></a>

When using Explore, the URL in the browser address bar updates as you make changes to the queries. You can share or bookmark this URL.

**Note**  
Explore may generate relatively long URLs. You can also generate and share a [shortened link](#v12-explore-share) if the URL is too long for your tools.

**Generating Explore URLs from external tools**

Because Explore URLs have a defined structure, you can build a URL from external tools and open it in Grafana. The url structure is:

```
http://<workspace_url>/explore?panes=<panes>&schemaVersion=<schema_version>&orgId=<org_id>
```

where:
+ `org_id` is the organization ID
+ `schema_version` is the schema version (should be set to the latest version, which is `1`.
+ `panes` is a url-encoded JSON object of panes, where each key is the pane ID and each value is an object matching the following schema:

  ```
  {
    datasource: string; // the pane's root datasource UID, or `-- Mixed --` for mixed datasources
    queries: {
      refId: string; // an alphanumeric identifier for this query, must be unique within the pane, i.e. "A", "B", "C", etc.
      datasource: {
        uid: string; // the query's datasource UID ie: "AD7864H6422"
        type: string; // the query's datasource type-id, i.e: "loki"
      }
      // ... any other datasource-specific query parameters
    }[]; // array of queries for this pane
    range: {
      from: string; // the start time, in milliseconds since epoch
      to: string; // the end time, in milliseconds since epoch
    }
  }
  ```
**Note**  
The `from` and `to` fields also accept relative ranges as described in the [Setting dashboard time range](v12-dash-using-dashboards.md#v12-dash-setting-dashboard-time-range) topic.

## Share shortened link
<a name="v12-explore-share"></a>

The Share shortened link capability allows you to create smaller and simpler URLs of the format /goto/:uid instead of using longer URLs with query parameters. To create a shortened link to the query results, select the **Share** option in the Explore toolbar. A shortened link that is never used will automatically get deleted after seven (7) days. If a link is used at least once, it won't get deleted.

**Sharing shortened links with absolute time**

Short links have two options: keeping relative time (for example, from two hours ago to the current time) or absolute time (for example, from 8am to 10am). Sharing a shortened link by default will copy the time range selected, relative or absolute. Choosing the dropdown button next to the share shortened link button and selecting one of the options under **Time-Sync URL Links** will allow you to create a short link with the absolute time, meaning anyone receiving the link will see the same data you are seeing, even if they open the link at another time. This option will not affect the time range selected in your Explore view.

# Query management in Explore
<a name="v12-explore-manage"></a>

****  
This documentation topic is designed for Grafana workspaces that support **Grafana version 12.x**.  
For Grafana workspaces that support Grafana version 10.x, see [Working in Grafana version 10](using-grafana-v10.md).  
For Grafana workspaces that support Grafana version 9.x, see [Working in Grafana version 9](using-grafana-v9.md).  
For Grafana workspaces that support Grafana version 8.x, see [Working in Grafana version 8](using-grafana-v8.md).

You can manage the queries that you have created in Explore, including a history of queries that you have run, and queries that you have starred.

## Query history
<a name="v12-explore-manage-history"></a>

Query history is a list of queries that you used in Explore. The history is stored in the Grafana database and it is not shared with other users. The retention period for queries in history is two weeks. Queries older than two weeks are automatically deleted. To open and interact with your history, select the **Query history** button in Explore.

**Note**  
Starred (favorited) queries are not subject to the two weeks retention period and they are not deleted.

## View query history
<a name="v12-explore-manage-history-view"></a>

Query history lets you view the history of your querying. For each individual query, you can:
+ Run the query.
+ Create and/or edit a comment.
+ Copy a query to the clipboard.
+ Copy a shortened link with the query to the clipboard.
+ Star (favorite) a query.

## Manage favorite queries
<a name="v12-explore-manage-history-favorites"></a>

All queries that have been starred in the Query history tab are displayed in the Starred tab. This allows you to access your favorite queries faster and to reuse these queries without typing them from scratch.

## Sorting query history
<a name="v12-explore-manage-history-sort"></a>

By default, query history shows you the most recent queries. You can sort your history by date or by data source name in ascending or descending order.

**To sort your query history**

1. Select the **Sort queries by** field.

1. Select one of the following options:
   + **Newest first**
   + **Oldest first**

## Filtering query history
<a name="v12-explore-manage-history-filter"></a>

You can filter your query history in Query history and Starred tab to a specific data source.

**To filter history to a data source**

1. Select the **Filter queries for specific data source(s)** field.

1. Select the data source for which you would like to filter your history. You can select multiple data sources.

**Note**  
Queries ran using the Mixed data source will appear only when filtering for Mixed, and not when filtering by their individual data sources.

In the **Query history** tab it is also possible to filter queries by date using the slider:
+ Use the vertical slider to filter queries by date.
+ Adjust the start date by dragging the bottom handle.
+ Adjust the end date by dragging the top handle.

## Searching in query history
<a name="v12-explore-manage-history-search"></a>

You can search in your history across queries and your comments. Search is possible for queries in the Query history tab and Starred tab.

**To search in query history**

1. Select the **Search queries** field.

1. Enter the term you are searching for into search field.

## Query history settings
<a name="v12-explore-manage-history-settings"></a>

You can customize the query history in the Settings tab. Options are described in the following table.


| Setting | Default value | 
| --- | --- | 
| Change the default active tab | Query history tab | 

**Note**  
Query history settings are global, and applied to both panels in split mode.

# Logs in Explore
<a name="v12-explore-logs"></a>

****  
This documentation topic is designed for Grafana workspaces that support **Grafana version 12.x**.  
For Grafana workspaces that support Grafana version 10.x, see [Working in Grafana version 10](using-grafana-v10.md).  
For Grafana workspaces that support Grafana version 9.x, see [Working in Grafana version 9](using-grafana-v9.md).  
For Grafana workspaces that support Grafana version 8.x, see [Working in Grafana version 8](using-grafana-v8.md).

Explore allows you to investigate your logs in different data sources, including:
+ [OpenSearch](using-opensearch-in-AMG.md)
+ [Amazon CloudWatch](using-amazon-cloudwatch-in-AMG.md)
+ [InfluxDB](using-influxdb-in-AMG.md)
+ [Loki](using-loki-in-AMG.md)

During an infrastructure monitoring and incident response, you can dig deeper into the metrics and logs to find the cause. Explore also allows you to correlate logs with other telemetry signals such as metrics, traces, or profiles, by viewing them side-by-side. You can also add correlations to external URLs directly from Explore, enabling seamless navigation between data sources and external systems.

The logs visualization panel provides improved log rendering with a field selector component for customizing which fields are displayed. Loki queries in Explore support forward direction search, allowing you to search logs from oldest to newest.

The results of log queries are displayed as individual log lines and as a graph showing the logs volume for the selected time period.

## Logs volume
<a name="v12-explore-logs-volume"></a>

When working with data sources that support a full range logs volume, Explore automatically displays a graph showing the log distribution for all the entered log queries. This feature is currently supported by OpenSearch and Loki data sources.

**Note**  
In Loki, this full range log volume is rendered by a metric query which can be expensive depending on the time range queried. This query can be particularly challenging to process for smaller Loki installations. To mitigate this, you can use a proxy like [nginx](https://www.nginx.com/) in front of Loki to set a custom timeout (for example, 10 seconds) for these queries. Log volume histogram queries can be identified by looking for queries with the HTTP header `X-Query-Tags` with value `Source=logvolhist`; these headers are added by Grafana to all log volume histogram queries.

If the data source does not support loading the full range logs volume, the logs model calculates a time series by counting log rows and organizing them into buckets based on an automatically calculated time interval. The timestamp of the first log row is used to anchor the start of the logs volume in the results. The end of the time series is anchored to the time picker’s **To** range. This way, you can still analyze and visualize log data efficiently even when the data source doesn’t offer full range support.

## Logs
<a name="v12-explore-logs-overview"></a>

In the following sections, you will find detailed explanations of how to visualize and interact with individual logs in Explore.

## Logs navigation
<a name="v12-explore-logs-navigation"></a>

Logs navigation, at the right side of the log lines, can be used to easily request additional logs. You can do this by clicking the **Older logs** button at the bottom of the navigation. This is especially useful when you reach the line limit and you want to see more logs. Each request that is run from the navigation is then displayed in the navigation as separate page. Every page shows `from` and `to` timestamps of the incoming log lines. You can see previous results by clicking on each page. Explore caches the last five requests run from the logs navigation, so you’re not re-running the same queries when clicking on the pages, saving time and resources.

## Visualization options
<a name="v12-explore-log-visualization-options"></a>

 You can customize how logs are displayed and select which columns are shown. 


| Option | Description | 
| --- | --- | 
| Time | Shows or hides the time column. This is the timestamp associated with the log line as reported from the data source. | 
| Unique labels | Shows or hides the unique labels column that includes only non-common labels. All common labels are displayed above. | 
| Wrap lines | Set this to true if you want the display to use line wrapping. If set to false, it will result in horizontal scrolling. | 
| Prettify JSON |  Set this to true to pretty print all JSON logs. This setting does not affect logs in any format other than JSON. | 
| Deduplication | Log data can be very repetitive and Explore can help by hiding duplicate log lines. There are a few different deduplication algorithms that you can use. Exact matches are done on the whole line except for date fields. Numbers matches are done on the line after stripping out numbers such as durations, IP addresses, and so on. Signature is the most aggressive deduplication as it strips all letters and numbers and matches on the remaining whitespace and punctuation. | 
| Display results order | You can change the order of received logs from the default descending order (newest first) to ascending order (oldest first). | 

## Download log lines
<a name="v12-explore-download-log-lines"></a>

To download log results in either `txt` or `json` format, use the **Download** button. This feature allows you to save the log data for further analysis or to share it with others in a convenient and accessible format.

## Log result meta information
<a name="v12-explore-log-result-meta-information"></a>

Above the received log lines you can find essential meta information, including:
+ **Number of received logs** – Indicates the total count of logs received for the current query or time range.
+ **Error** – Displays possible error in your log results.
+ **Common labels** – Shows common labels.
+ **Total bytes processed** – Represents the cumulative size of the log data processed in bytes.

**Note**  
The availability of certain meta information may depend on the data source, and as a result, you may only see some of these details for specific data sources.

## Escaping newlines
<a name="v12-explore-log-escaping-newlines"></a>

Explore automatically detects some incorrectly escaped sequences in log lines, such as newlines (`\n`, `\r`) or tabs (`\t`). When it detects such sequences, Explore provides an **Escape newlines** option.

**To automatically fix incorrectly escaped sequences that Explore has detected**

1. Choose **Escape newlines** to replace the sequences.

1. Manually review the replacements to confirm their correctness.

Explore replaces these sequences. When it does so, the option will change from **Escape newlines** to **Remove escaping**. Evaluate the changes as the parsing may not be accurate based on the input received. You can revert the replacements by selecting **Remove escaping**.

## Log level
<a name="v12-explore-log-level"></a>

For the logs where a `level` label is specified, we use the value of this label to determine the log level and update color of each log line accordingly. If the log doesn’t have specified level label, we try to find out if its content matches any of the supported expressions (see the following table for more information). The log level is always determined by the first match. In the case where Grafana is not able to infer a log level field, it will be visualized with an unknown log level.

**Note**  
If you use a Loki data source and the `level` is part of your log line, you can use parsers (JSON, logfmt, regex,..) to extract the level information into a level label that is used to determine the level value. This will allow the histogram to show the various log levels as separate bars.

**Supported log levels and mapping of log level abbreviation and expressions:** 


| Log level | Color | Supported expressions | 
| --- | --- | --- | 
| critical | purple | emerg, fatal, alert, crit, critical | 
| error | red | err, eror, error | 
| warning | yellow | warn, warning | 
| info | green | info, information, informational, notice | 
| debug | blue | dbug, debug | 
| trace | light blue | trace | 
| unknown | grey | \$1 | 

## Highlight searched words
<a name="v12-explore-highlight-searched-words"></a>

When your query includes specific words or expressions to search for, Explore will highlight these in the log lines for better visibility. This highlighting feature makes it easier to identify and focus on the relevant content in your logs.

**Note**  
The ability to highlight search words may vary depending on the data source. For some data sources, the highlighting of search words may not be available.

## Log details view
<a name="v12-explore-log-details-view"></a>

In Explore, each log line has an expandable section called *Log details* that can be opened by choosing the log line. The Log details view provides additional information and exploration options in the form of *Fields* and *Links* attached to the log lines, enabling a more robust interaction and analysis.

**Fields**

Within the Log details view, you can filter displayed fields in two ways: a positive filter (to focus on an specific field) and a negative filter (to exclude certain fields). These filters will update the corresponding query that produced the log line, adding equality and inequality expressions accordingly. If the data source has support, as is the case for Loki and OpenSearch, log details will check if the field is already present in the current query showing and active state (for positive filters only), allowing you to toggle it off the query, or changing the filter expression from positive to negative.

You can select a subset of fields to visualize in the logs list instead of the complete log line by clicking on the eye icon. Each field has a stats icon to display statistics in relation to all displayed logs.

**Links**

Grafana offers the functionality of data links or correlations, enabling you to convert any part of a log message into an internal or external link. These links can be used to navigate to related data or external resources, providing a seamless and convenient way to explore further information.

## Log context
<a name="v12-explore-log-context"></a>

Log context displays additional lines of context surrounding a log entry that matches a particular search query. This can be helpful in understanding the log entry’s context, and is similar to the `-C` parameter in the `grep` command.

You may encounter long lines of text that make it difficult to read and analyze the context around each log entry. This is where the **Wrap lines** toggle can come in handy. By enabling this toggle, Grafana will automatically wrap long lines of text so that they fit within the visible width of the viewer. This can make it easier to read and understand the log entries. 

 The **Open in split view** button allows you to execute the context query for a log entry in a split screen in the Explore view. Choosing this button will open a new Explore pane with the context query displayed alongside the log entry, making it easier to analyze and understand the surrounding context.

The log context query can also be opened in a new browser tab by pressing the `Ctrl` (or `Cmd`) key while choosing the button to open the context modal. When opened in a new tab, the previously selected filters are applied as well.

## Copy log line
<a name="v12-explore-copy-log-line"></a>

You can easily copy the content of a selected log line to your clipboard by choosing the **Copy log line** button.

## Copy link to log line
<a name="v12-explore-copy-link-to-log-line"></a>

Linking of log lines in Grafana allows you to quickly navigate to specific log entries for precise analysis. By choosing the **Copy shortlink** button for a log line, you can generate and copy a short URL that provides direct access to the exact log entry within an absolute time range. When you open the link, Grafana will automatically scroll to the corresponding log line and highlight it with a blue background, making it easy to identify and focus on the relevant information.

**Note**  
This is only supported in Loki and other data sources that provide an `id` field.

# Tracing in Explore
<a name="v12-explore-tracing"></a>

****  
This documentation topic is designed for Grafana workspaces that support **Grafana version 12.x**.  
For Grafana workspaces that support Grafana version 10.x, see [Working in Grafana version 10](using-grafana-v10.md).  
For Grafana workspaces that support Grafana version 9.x, see [Working in Grafana version 9](using-grafana-v9.md).  
For Grafana workspaces that support Grafana version 8.x, see [Working in Grafana version 8](using-grafana-v8.md).

You can use Explore to visualize traces from tracing data sources. The legacy Tempo Search and Loki Search interfaces have been removed in favor of the TraceQL-powered search experience.

The following data sources are supported.
+ [Tempo](tempo-data-source.md) (supported ingestion formats: OpenTelemetry, Jaeger, and Zipkin)
+ [Jaeger](jaeger-data-source.md)
+ [AWS X-Ray](x-ray-data-source.md)
+ [Zipkin](zipkin-data-source.md)
+ [OpenSearch](using-opensearch-in-AMG.md)

For information on how to configure queries for the data sources listed above, refer to the documentation for specific data source.

## Query editor
<a name="v12-explore-trace-queryeditor"></a>

You can query and search tracing data using a data source's query editor.

Each data source can have its own query editor. The query editor for the Tempo data source is slightly different than the query editor for the Jaeger data source.

For information on querying each data source, refer to their documentation.
+ [Tempo](tempo-data-source.md)
+ [Jaeger](jaeger-data-source.md)
+ [AWS X-Ray](x-ray-data-source.md)
+ [Zipkin](zipkin-data-source.md)
+ [OpenSearch](using-opensearch-in-AMG.md)

## Trace View explanation
<a name="v12-explore-trace-view"></a>

This section explains the elements of the Trace View dashboard.

**Header**

The header of the trace view has the following elements:
+ Header title – Shows the name of the root span and trace ID.
+ Search – Highlights spans containing the searched text.
+ Metadata – Various metadata about the trace.

**Minimap**

Shows condensed view or the trace timeline. Drag your pointer over the minimap to zoom into smaller time range. Zooming will also update the main timeline, so it is easy to see shorter spans. Hovering over the minimap, when zoomed, will show the **Reset Selection** button which resets the zoom.

**Span filters**

Using span filters, you can filter your spans in teh trace timeline viewer. The more filters you add, the more specific are the filtered spans.

You can add one or more of the following filters:
+ Resource service name
+ Span name
+ Duration
+ Tags (which include tags, process tags, and log fields)

To show only the spans you have matched, choose the **Show matches only** toggle.

**Timeline**

Shows list of spans within the trace. Each span row consists of these components:
+ Expand children button – Expands or collapses all the children spans of the selected span.
+ Service name – Name of the service that logged the span.
+ Operation name – Name of the operation that this span represents.
+ Span duration bar – Visual representation of the operation duration within the trace.

**Span details**

Choosing the span row shows span details, including the following.
+ Operation name
+ Span metadata
+ Tags – Any tags associated with this span.
+ Process metadata – Metadata about the process that logged this span.
+ Logs – List of logs logged by this span and associated key values. In case of Zipkin logs section shows Zipkin annotations.

**Trace to logs**

You can navigate from a span in a trace view directly to logs relevant for that span. This is available for Tempo, Jaeger, and Zipkin data sources. Refer to their relevant documentation for instructions on how to configure each data source.

Choose the document icon to open a split view in Explore with the configured data source and query relevant logs for the span.

**Trace to metrics**

**Note**  
This feature is currently in beta

You can navigate form a span in a trace view directly to metrics relevant for that span. This feature is available for Tempo, Jaeger, and Zipkin data sources. Refer to their relevant documentation for details on configuration.

**Trace to profiles**

Using Trace to profiles, you can use Grafana's ability to correlate different signales by adding the functionality to link between traces and profiles.

## Node graph
<a name="v12-explore-trace-node-graph"></a>

You can optionally expand the node graph for the displayed trace. Depending on the data source, this can show spans of the trace as nodes in the graph, or add some additional context, including the service graph based on the current trace.

## Service Graph view
<a name="v12-explore-trace-graph"></a>

The Service Graph view visualizes the span metrics (traces data for rates, error rates, and durations (RED)) and service graphs. Once the requirements are set up, this pre-configured view is immediately available.

For more information, see [Tempo](tempo-data-source.md) data source page. You can also see the [service graph view page](https://grafana.com/docs/tempo/latest/metrics-generator/service-graph-view/) in the *Grafana Labs Tempo documentation*.

## Data API
<a name="v12-explore-trace-dataapi"></a>

This visualization needs a specific shape of the data to be returned from the data source in order to correctly display it.

The data source needs to return data frame and set `frame.meta.preferredVisualisationType = 'trace'`.

**Data frame structure**

Required fields;


| Field name | Type | Description | 
| --- | --- | --- | 
| traceID | string | Identifier for the entire trace. There should be only one trace in the data frame. | 
| spanID | string | Identifier for the current span. SpanIDs should be unique per trace. | 
| parentSpanID | string | SpanID of the parent span to create child parent relationship in the trace view. Can be undefined for root span without a parent. | 
| serviceName | string | Name of the service this span is part of. | 
| serviceTags | TraceKeyValuePair[] | List of tags relevant for the service. | 
| startTime | number | Start time of the span in millisecond epoch time. | 
| duration | number | Duration of the span in milliseconds. | 

 Optional fields: 


| Field name | Type | Description | 
| --- | --- | --- | 
| logs | TraceLog[] | List of logs associated with the current span. | 
| tags | TraceKeyValuePair[] | List of tags associated with the current span. | 
| warnings | string[] | List of warnings associated with the current span. | 
| stackTraces | string[] | List of stack traces associated with the current span. | 
| errorIconColor | string | Color of the error icon in case span is tagged with error: true. | 

For details about the types see [TraceSpanRow](https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/types/trace.ts#L28), [TraceKeyValuePair](https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/types/trace.ts#L4) and [TraceLog](https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/types/trace.ts#L12) on GitHub.

# Correlations editor in Explore
<a name="v12-explore-correlations"></a>

****  
This documentation topic is designed for Grafana workspaces that support **Grafana version 12.x**.  
For Grafana workspaces that support Grafana version 10.x, see [Working in Grafana version 10](using-grafana-v10.md).  
For Grafana workspaces that support Grafana version 9.x, see [Working in Grafana version 9](using-grafana-v9.md).  
For Grafana workspaces that support Grafana version 8.x, see [Working in Grafana version 8](using-grafana-v8.md).

Correlations allow users to build a link between any two data sources. For more information, including an overview of correlations, see [Correlations in Grafana version 12](v12-correlations.md).

## Creating a correlation
<a name="v12-explore-corr-create-a-correlation"></a>

You can create correlations from the Explore page.

**To create a correlation**

1. In your Amazon Managed Grafana workspace, navigate to the Explore page.

1. Select a data source that you would like to be the source for a new correlation.

1. Run a query producing data in a supported visualization.
**Note**  
Supported visualizations are [Logs](v12-panels-logs.md) and [Table](v12-panels-table.md).

1. Choose **\$1 Add** in the top toolbar and select **Add correlation** (you can also select **Correlations Editor** from the [Command Palette](v12-search.md#v12-search-palette).

   Explore is now in Correlations Editor mode indicated by a blue border and top bar. You can exit Correlations Editor by choosing **Exit** in the top bar.

1. You can now create the following new correlations for the visualization with links that are attached to the data that you can use to build a new query:
   + *Logs* – links are displayed next to field values inside log details for each log row.
   + *Table* – every table cell is a link.

1. Choose a link to add a new correlation. Links are associated with a field that is used as a result field of a correlation. For more details, see [Correlation configuration](v12-correlations-config.md).

1. In the split view that opens, use the right pane to set up the target query source of the correlation. For more details, see [Target query](v12-correlations-config.md#v12-correlations-config-target-query).

1. Build a target query using [variables syntax](v12-dash-variable-syntax.md) with variables from the list provided at the top of the pane. The list contains sample values from the selected data row.

1. Provide a label and description (optional). A label will be used as the name of the link inside the visualization and can contain variables.

1. Provide transformations (optional; see below for details).

1. Choose **Save** in the top toolbar to save the correlation and exit Correlations Editor mode. The link used to create the correlation is replaced with a data link in each row. When the link is selected, the query you defined will run in another pane, with the variables replaced dynamically with the values from the selected row.

## Transformations
<a name="v12-explore-corr-transformations"></a>

Transformations allow you to extract values that exist in a field with other data. For example, using a transformation, you can extract one portion of a log line to use in a correlation. For more details on transformations in correlations, see [Correlation Transformations](v12-correlations-config.md#v12-correlations-config-transformations).

After choosing one of the generated links in the editor mode, you can add transformations by selecting **Add transformation** in the **Transformations** dropdown menu.

**To use a transformation in a correlation**

1. Select a field to apply the transformation to. Select the portion of the field that you want to use for the transformation. For example, a log line. Once selected, the value of this field will be used to assist you in building the transformation.

1. Select the type of the transformation. See [Correlation Transformations](v12-correlations-config.md#v12-correlations-config-transformations) for the options and relevant settings. 

1. Based on your selection, you might see one or more variables populate, or you might need to provide more specifications in options that are displayed.

1. Select **Add transformation to correlation** to add the specified variables to the list of available variables.

**Note**  
For regular expressions in this dialog box, the `mapValue` referred to in other documentation is called `Variable Name` here. Grafana highlights any text that matches the expression in the field value. Use regular expression capture groups to select what portion of the match should be extracted. When a valid regular expression is provided, the variable and the value of that variable appear below the `Variable Name` field.

## Correlations examples
<a name="v12-explore-corr-examples"></a>

The following examples show how to create correlations using the Correlations Editor in Explore. If you’d like to follow these examples, make sure to set up a [test data source](testdata-data-source.md).

### Creating a text to graph correlation
<a name="v12-explore-corr-text-to-graph"></a>

This example shows how to create a correlation using Correlations Editor in Explore.

Correlations allow you to use results of one query to run a new query in any data source. In this example, you will run a query that renders tabular data. The data will be used to run a different query that yields a graph result.

To follow this example, make sure you have set up a [test data source](testdata-data-source.md).

**To create a text to graph correlation**

1. In Grafana, navigate to **Explore**.

1. Select the **test data source** from the dropdown menu at the top left of the page.

1. Choose **\$1 Add** in the dropdown menu to the right and select **Add correlation**.

1. Explore is now in Correlations Editor mode, indicated by a blue border.

1. Select the following scenario from the scenario dropdown menu: **CSV File**.

1. Select the file, **population\$1by\$1state.csv**. Each cell is a link that you can click on to begin creating a new correlation.

1. Click on any cell in the `State` column to create a new correlation that attaches a data link to that entry. For example, select `California`.

1. In the split view, select the same data source you selected in the left pane. The helper above the query editor contains all available variables you can use the target query. Variables contain all data fields (table columns) from the selected row.

1. In the **Scenario** menu, select **CSV Metric Values**. The `String Input` field in the Query editor provides variables with population values for each year: `${1980},${2000},${2020}`. This will generate a graph using variable values.

1. In the Query Editor **Alias** field, enter `${State}`.

   Run a query to see that it produces a graph using sample values from the variables.

1. Choose **Save** to save the correlation and exit the Correlations Editor.

   After the correlation is saved, Explore will rerun the query in the left pane. By clicking a state name, the query on the right is rerun with values from the row being inserted into the CSV, thus changing the graph. The query is rerun with updated values every time you click on a state name.

You can apply the same steps to any data source. Correlations allow you to create links in visualizations to run dynamic queries based on selected data. In this example we used data returned by a query to build a new query generating different visualization using the same data source. However, you can create correlations between any data sources to create custom exploration flows.

### Creating a logs to table correlation
<a name="v12-explore-corr-logs-to-table"></a>

In this example, you will create a correlation to demonstrate how to use transformations to extract values from the log line and another field.

To follow this example, make sure you have set up a [test data source](testdata-data-source.md).

**To create a logs to table correlation**

1. In Grafana, navigate to **Explore**.

1. Select the **test data source** from the dropdown menu at the top left of the page.

1. Choose **\$1 Add** in the dropdown menu to the right and select **Add correlation**.

1. Explore is now in Correlations Editor mode, indicated by a blue border.

1. In the **Scenario** menu, select **Logs**.

1. Expand a log line to see the correlation links. Select `Correlate with hostname`.

1. Explore opens in split view. Select the same data source you selected in the left pane. The helper above the query editor contains all available variables you can use the target query.

1. Expand the transformations section, and click **Add transformation**.

1. In the **Field** dropdown menu, select **message**. The log line shows up as example data.

1. Under **Type**, select **Logfmt**. This populates the list of variables.

1. Choose **Add transformation to correlation**.

1. Choose **Add transformation** again and under **Field**, select **hostname**.

1. Under **Type**, select **Regular expression**.

1. Under **Expression**, enter the following: `-([0-9]\*)`. This selects any numbers to the right of the dash.

1. Under **Variable Name**, enter the following: `hostNumber`. This populates the list of variables. 

1. Choose **Add transformation to correlation** to add it to the other variables.

1. In the data source editor, open the **Scenario** dropdown menu and select **CSV Content**.

1. In the text box below, provide the following and save the correlation:

   ```
   time,msg,hostNumber,status
   ${time},${msg},${hostNumber},${status}
   ```

   This closes the split view and reruns the left query. Expand any log line to see the correlation button. Chooseing the correlation button opens the split view with the `time` (a field), `msg` (extracted with *logfmt* from the log line), `host number` (extracted with *regex* from the `hostname`) and the `status` (extracted with *logfmt* from the log line).

# Inspector in Explore
<a name="v12-explore-inspector"></a>

****  
This documentation topic is designed for Grafana workspaces that support **Grafana version 12.x**.  
For Grafana workspaces that support Grafana version 10.x, see [Working in Grafana version 10](using-grafana-v10.md).  
For Grafana workspaces that support Grafana version 9.x, see [Working in Grafana version 9](using-grafana-v9.md).  
For Grafana workspaces that support Grafana version 8.x, see [Working in Grafana version 8](using-grafana-v8.md).

The inspector helps you understand and troubleshoot your queries. You can inspect the raw data, export that data to a comma-separated values (CSV) file, export log results in TXT format, and view query requests.

## Inspector UI
<a name="v12-explore-inspector-ui"></a>

The inspector has the following tabs:
+ **Stats tab** – Shows how long your query takes and how much it returns.
+ **Query tab** – Shows you the requests to the server sent when Grafana queries the data source.
+ **JSON tab** – Allows you to view and copy the data JSON and data frame structure JSON.
+ **Data tab** – Shows the raw data returned by the query.
+ **Error tab** – Shows the error. Only visible when query returns error.

## Inspector tasks
<a name="v12-explore-inspector-tasks"></a>

You can perform a variety of tasks in the Explore inspector.

**Open the Inspector**

After you run the query you would like to inspect, select the **Inspector** button.

The inspector pane opens on the bottom of the screen.

**Inspect raw query results**

You can view raw query results, that is the data returned by the query in a table.

In the **Inspector** tab, click the **Data** tab.

For multiple queries or for queries multiple nodes, there are additional options.
+ **Show data frame:** Select the result set data you want to view.
+ **Series joined by time:** View the raw data from all of your queries at once, one result set per column. You can click a column heading to sort the data.

**Download raw query results as CSV**

Grafana generates a CSV file in your default browser download location. You can open it in the viewer of your choice.

1. In the **Inspector** tab, get raw query results by following the instructions above.

1. Refine the query settings until you can see the raw data that you want to export.

1. Choose **Download CSV**.

In order to download a CSV file specifically formatted for Excel, expand **Data options** and then turn on the **Download for Excel** toggle before you select the **Download CSV** option.

**Download log results as TXT**

You can generate a TXT file of the logs you are currently viewing, by selecting **Download logs** in the **Inspector**tab.

**Download trace results**

Based on the data source type, Grafana generates a JSON file for the trace results in one of the supported formats: Jaeger, Zipkin, or OTLP formats.

1. Open the Inspector.

1. Inspect the log query results. Refine the results until you see the raw logs that you want to export.

1. Choose **Download logs**.

**Inspect query performance**

The **Stats** tab displays statistics that tell you how long your query takes, how many queries you send, and the number of rows returned. This information can help you troubleshoot your queries, especially if any of the numbers are unexpectedly high or low.

Statistics are displayed in read-only format.

**View JSON model**

You can explore and export data as well as data frame JSON models.

**To view the JSON model**

1. In the Inspector panel, click the **JSON** tab.

1. From the **Select source** dropdown, choose one of the following options:
   + **Data** – Displays a JSON object representing the data that was returned to Explore.
   + **DataFrame structure** – Displays the raw result set.

1. You can expand or collapse portions of the JSON to view separate sections. You can also select the **Copy to clipboard** option to copy JSON body and paste it into another application.

**View raw request and response to data source**

As you are working with Explore and the Inspector tab, you can view the raw request and response data that you are generating with a query. In the Inspector, select the **Query** tab and choose **Refresh** to see the raw data.

Grafana sends the query to the server and displays the result. You can drill down on specific portions of the query, expand or collapse all of it, or copy the data to the clipboard to use in other applications.