Skip to main content

Data Explorer

Data Explorer allows users to query Logs, Traces and Metrics from one place.

  • Logs and Traces datasets are queried in SQL, including JOIN queries within and across Logs and Traces datasets. In queries that read both types, datasets are written with a logs. or traces. prefix, for example joining logs.app_logs with traces.otel_traces on trace_id.
  • Metrics are queried in PromQL using the SQL | PromQL switch in the editor, with metric and label autocompletion.

For SQL syntax, see the SQL Query Guide.

Why use Data Explorer​

Most investigations need more than one dataset: an error log points to a request, the request's trace shows where time was spent, and the same service may write to several datasets. Data Explorer lets one query read all of them, so there is no need to run separate searches and match the results by hand.

  • Correlate logs with traces. Join a logs dataset with a traces dataset on trace_id to see the log lines behind slow or failed spans.
  • Combine datasets of the same type. Read several logs datasets, or several traces datasets, in one query, for example to compare errors across services that log to different datasets.
  • Keep every signal in one editor. Switch to PromQL for metrics without leaving the page, then save, share or reopen the query later.

Example Queries​

The dataset and column names below are examples. Use the Schema panel to find the names in your workspace.

Error logs with the duration of their traces. The query reads both Logs and Traces datasets, so every dataset has its prefix.

SELECT l.service_name, l.body, t.operation_name, t.duration
FROM logs.app_logs AS l
JOIN traces.otel_traces AS t ON l.trace_id = t.trace_id
WHERE l.severity = 'ERROR'
ORDER BY t.duration DESC
LIMIT 50

Errors per service across two logs datasets. Both datasets are logs, so no prefix is needed.

SELECT service_name, COUNT(*) AS errors
FROM (
SELECT service_name FROM app_logs WHERE severity = 'ERROR'
UNION ALL
SELECT service_name FROM nginx_logs WHERE severity = 'ERROR'
) AS all_errors
GROUP BY service_name
ORDER BY errors DESC
LIMIT 20

How to Use It​

  1. Go to the Data Explorer page.
  2. Browse Logs, Traces and Metrics datasets and their fields in the Schema panel, or start from Templates.
  3. Choose SQL to query Logs and Traces datasets or PromQL to query Metrics datasets using the switch in the editor.
  4. Write the query in the editor.
  5. In a SQL query that reads both Logs and Traces datasets, prefix each dataset with logs. or traces., for example logs.app_logs and traces.otel_traces.
  6. Select the required time range.
  7. Run the query with Ctrl/Cmd + Enter.
  8. View the results as a Table, Time series or Bar chart.
  9. To reuse the query, save it from Saved queries, or reopen a previous run from History.

Note: Saved PromQL queries can't use variables.

Availability:​

Available to all users.

dataExplorer explain