2022-05-26 23:06:25 +08:00
---
keywords:
- explore
- loki
- logs
Explicitly set all front matter labels in the source files (#71548)
* Set every page to have defaults of 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/enterprise-licensing pages to have 'Enterprise' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/recorded-queries pages to have labels cloud,enterprise
* Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/stats-and-license pages to have labels cloud,enterprise
* Set alerting pages to have labels cloud,enterprise,oss
* Set breaking-changes pages to have labels cloud,enterprise,oss
* Set dashboards pages to have labels cloud,enterprise,oss
* Set datasources pages to have labels cloud,enterprise,oss
* Set explore pages to have labels cloud,enterprise,oss
* Set fundamentals pages to have labels cloud,enterprise,oss
* Set introduction/grafana-cloud pages to have labels cloud
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Fix introduction pages products
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set panels-visualizations pages to have labels cloud,enterprise,oss
* Set release-notes pages to have labels cloud,enterprise,oss
* Set search pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set troubleshooting pages to have labels cloud,enterprise,oss
* Set whatsnew pages to have labels cloud,enterprise,oss
* Apply updated labels from review
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
---------
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
2023-07-18 16:10:12 +08:00
labels:
products:
- cloud
- enterprise
- oss
2024-07-23 22:55:57 +08:00
title: Query management in Explore
2022-05-26 23:06:25 +08:00
weight: 10
2025-09-06 04:36:16 +08:00
refs:
saved-queries:
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /panels-visualizations/query-transform-data/#saved-queries
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/#saved-queries
2022-05-26 23:06:25 +08:00
---
2021-02-03 01:04:00 +08:00
# Query management in Explore
2024-07-23 22:55:57 +08:00
Grafana Explore provides a variety of tools to help manage your queries.
2021-02-03 01:04:00 +08:00
2025-06-20 00:31:13 +08:00
{{< admonition type = "note" > }}
2024-07-23 22:55:57 +08:00
For help with debugging queries, Explore allows you to investigate query requests and responses, as well as query statistics, via the Query inspector. Refer to [Query inspector in Explore ](/docs/grafana/<GRAFANA_VERSION>/explore/explore-inspector/ ) for more information.
2025-06-20 00:31:13 +08:00
{{< / admonition > }}
2021-02-03 01:04:00 +08:00
## Query history
2024-07-23 22:55:57 +08:00
Query history contains the list of queries that you created in Explore. This history is stored in the Grafana database and isn't shared with other users. The retention period for a query history is **two weeks** . Queries older than two weeks are automatically deleted.
2022-07-25 21:00:56 +08:00
2025-06-20 00:31:13 +08:00
{{< admonition type = "note" > }}
2024-07-23 22:55:57 +08:00
Starred queries aren't subject to the two-week retention period and aren't deleted.
2025-06-20 00:31:13 +08:00
{{< / admonition > }}
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
To view your query history:
1. Go to the Explore page.
1. Click **Query history** .
The Query history pane opens at the bottom of the page, and contains the following tabs:
- **Query history tab-** Contains a history of all your queries, with options for searching and managing them.
- **Starred tab -** Contains all of your starred queries.
- **Settings tab-** Provides customizable options for your query history.
### Query history tab
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
The Query history depicts a history of your queries for the past two weeks, unless the query is starred, which means it doesn't get deleted. For each individual query, you can:
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
- Run and re-run the query.
2021-02-03 01:04:00 +08:00
- Create and/or edit a comment.
- Copy a query to the clipboard.
- Copy a shortened link with the query to the clipboard.
2024-07-23 22:55:57 +08:00
- Delete a query.
2021-02-03 01:04:00 +08:00
- Star a query.
2025-09-06 04:36:16 +08:00
- Add a query from your history to your [saved queries ](ref:saved-queries ).
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
By default, query history shows you newest queries first. Click the sort box in the upper right to change to **Oldest first** to older queries first. You can search your queries using keywords.
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
### Query history Starred tab
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
All starred queries are displayed in the **Starred** tab. This gives quick access to key or favorite queries without having to rewrite them.
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
You also have the option to switch the data source and run a starred query.
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
#### Filter query history
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
Filter query history in both the **Query history** and **Starred** tabs by data source name:
2021-02-03 01:04:00 +08:00
1. Click the **Filter queries for specific data source(s)** field.
2024-07-23 22:55:57 +08:00
1. Select the data source in the dropdown by which you want to filter your history. You can select multiple data sources.
2025-06-20 00:31:13 +08:00
{{< admonition type = "note" > }}
2024-07-23 22:55:57 +08:00
Queries with the **Mixed** data source appear only when filtering for "Mixed" and not when filtering by individual data source.
2025-06-20 00:31:13 +08:00
{{< / admonition > }}
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
You can also filter queries by date using the vertical slider:
2023-07-17 19:25:49 +08:00
2024-07-23 22:55:57 +08:00
- Drag the bottom circle to adjust the start date.
- Drag the top circle to adjust the end date.
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
#### Search in query history
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
Use **Search queries** in both the **Query history** and **Starred** tabs to search your query history and comments using keywords.
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
1. Click in the **Search queries** field.
1. Type the keyword(s) or term you are want to search for in search field.
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
### Query history Settings tab
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
You can customize your query history in the **Settings** tab.
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
Toggle **Change the default active tab from "Query history" to "Starred"** to make the **Starred tab** the default active tab.
2021-02-03 01:04:00 +08:00
2025-06-20 00:31:13 +08:00
{{< admonition type = "note" > }}
2024-07-23 22:55:57 +08:00
Query history settings are global, and applied to both panels in split mode.
2025-06-20 00:31:13 +08:00
{{< / admonition > }}
2021-02-03 01:04:00 +08:00
2024-07-23 22:55:57 +08:00
<!-- 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. -->