RousselTMLEARNING

Article · Grafana: From Discovery to Expertise

Correlations: link data sources

1. What is a correlation? #

Linking signals across data sources.

The principle #

Available in: ✓ OSS ✓ Enterprise ✓ Cloud Grafana 10 and later; used in Explore

A correlation defines a link between a source data source and a target: a query in another data source, or an external URL. Grafana then adds a link on the values of a result field: from a Loki log line, a click on the traceID opens the trace in Tempo; from a host name, a click opens its metrics in Prometheus.

Unlike derived fields or data links, configured per data source or per panel, correlations are managed centrally by the administrator, in a single screen.

Loki source, transformation extracting the traceID, Tempo target, opened in Explore.
The link appears in the log line details and opens the target in a split view.

The two types #

  • Query: the target is a query in a data source (Tempo, Prometheus, Elasticsearch…), opened in Explore next to the source.
  • External: the target is a URL (ticketing tool, CMDB, runbook) into which result values are injected.
A result field feeds a query correlation or an external link.
Choose « external » to leave Grafana.

2. Creating a correlation #

In the UI or through provisioning.

In the UI #

  1. Open Administration › Plugins and data › Correlations then Add new.
  2. Give a label (the link text) and a description.
  3. Pick the type and target: data source and query (with variables such as ${traceId}), or URL.
  4. Pick the source data source and the result field that carries the link (for example traceID).
  5. Add transformations if needed to extract a value, then save.

You can also create a correlation from Explore, in correlation editor mode, starting from a real result.

Through provisioning #

Correlations are declared in the source data source provisioning file, under the correlations key. They are then versioned and read-only in the UI.

# provisioning/datasources/correlations.yaml
apiVersion: 1
datasources:
  - name: Loki
    type: loki
    uid: loki
    url: http://loki:3100
    correlations:
      - targetUID: tempo
        label: "Open trace"
        description: "Tempo trace for this log line"
        type: query
        config:
          field: traceID
          target:
            query: "${traceId}"
          transformations:
            - type: regex
              field: Line
              expression: 'traceID=(\w+)'
              mapValue: traceId
Good to know: in older versions the type key goes inside config; check the format expected by your version.

3. Variables and transformations #

Building the target query.

Variables #

In the target query or URL, ${name} is replaced by the value of the field with the same name in the clicked row. Transformations create new variables from a field.

Target Prometheus query: rate(http_requests_total{instance="${host}"}[5m])
External URL: https://tickets.example.com/new?service=${service}&trace=${traceId}

Transformations #

TypeUseParameters
regexExtract a value from free textfield, expression (first capture group), mapValue (variable name)
logfmtSplit a key=value line into variablesfield
Line: level=error service=api traceID=4bf92f3577b34da6 duration=812ms
logfmt → ${level}, ${service}, ${traceID}, ${duration}
Common mistake: a variable missing from the clicked row: the link does not appear. Check the exact field name (case-sensitive) in the row details.

4. Permissions, limits and best practices #

What to know before rolling out.

Permissions and limits #

  • Managing correlations is restricted to organization administrators (or roles granted through role-based access control).
  • Links appear in Explore (log details, table cells); in dashboards, use data links or derived fields.
  • Users need access to the target data source to follow a query link.

Best practices #

  • Start with the most frequent investigation paths: log → trace, trace → service metrics, alert → runbook.
  • Use explicit action labels (« Open trace », « Show host metrics »).
  • Normalize field names (traceID, service.name) at collection time, with Alloy or the OpenTelemetry Collector, to reuse the same correlations everywhere.
  • Provision correlations with the data sources to get identical ones on every environment.
Good practice: combine correlations with Tempo trace-to-logs links: investigations then flow both ways between logs and traces.

📄 Correlations in Grafana: jump from one data source to another →

My progress

  • ⏱ Estimated time : ≈ 8 min

Sign in to track your progress and take notes. Sign in

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Course Glossary

Alerting

The process of notifying teams (via email, Slack, Teams) when a specific event, threshold breach, or anomaly is detected.

HTTP Code 200 (OK)

An HTTP status code indicating that the client's request was successfully processed by the server.

HTTP Code 403 (Forbidden)

An HTTP status code indicating that the server understood the request but refuses to authorize it, usually due to a lack of permissions.

HTTP Code 404 (Not Found)

An HTTP status code indicating that the requested resource could not be found on the server.

Grafana

An open-source interactive data visualization platform that allows users to create, explore, and share analytic dashboards from multiple time-series d...

Recommended Articles

Data sources in Grafana: connect and unify your data

Learn how to extend Grafana's capabilities with data sources. Discover essential plugins such as ...

Grafana provisioning: automate the management of your dashboards and data sources

Learn how to use Grafana provisioning to manage your configuration (dashboards, data sources, not...

The LGTM stack (Loki, Grafana, Tempo, Mimir): architecture and setup

Understand Grafana Labs' LGTM stack: Loki for logs, Grafana for visualization, Tempo for traces a...

Costs, usage and Private Data Source Connect in Grafana Cloud

Track Grafana Cloud consumption and query private data sources without exposing them.

Mastering transformations in Grafana: manipulate your data with agility

Learn how to use Grafana transformations to reformat, calculate and combine your data directly in...

Correlating traces, logs, metrics and profiles in Grafana

Link Tempo to logs (Loki), metrics (Prometheus) and profiles (Pyroscope): tracesToLogs, tracesToM...

Grafana: mastering queries (PromQL, LogQL, SQL and expressions)

Build efficient queries in Grafana: the query editor, Query Inspector, PromQL, LogQL, SQL, the Mi...

From click to database: front-end to back-end traces with Faro

Link browser requests to back-end traces: TracingInstrumentation, traceparent header propagation,...

Grafana Cloud: getting started with the managed platform (Mimir, Loki, Tempo, Alloy)

Discover Grafana Cloud: creating a stack, the free tier, sending metrics, logs and traces with Al...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!