2022-10-16 09:07:25 +08:00
---
2022-12-10 00:36:04 +08:00
aliases:
- ../../variables/url-variables/
- ../../variables/variable-types/url-variables/
2022-10-16 09:07:25 +08:00
keywords:
- grafana
- url variables
- documentation
- variables
- dashboards
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
2022-12-10 00:36:04 +08:00
title: Dashboard URL variables
2023-12-15 03:15:55 +08:00
description: Use variables in dashboard URLs to add more context to your links
2022-10-16 09:07:25 +08:00
weight: 250
2024-05-22 16:55:17 +08:00
refs:
2024-07-15 21:36:10 +08:00
ad-hoc-filters:
2024-05-22 16:55:17 +08:00
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /dashboards/variables/add-template-variables/#add-ad-hoc-filters
- pattern: /docs/grafana-cloud/
2024-06-21 22:02:16 +08:00
destination: /docs/grafana-cloud/visualizations/dashboards/variables/add-template-variables/#add-ad-hoc-filters
2024-05-22 16:55:17 +08:00
manage-dashboard-links:
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /dashboards/build-dashboards/manage-dashboard-links/
- pattern: /docs/grafana-cloud/
2024-06-21 22:02:16 +08:00
destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/manage-dashboard-links/
2024-07-15 21:36:10 +08:00
variables:
2024-05-22 16:55:17 +08:00
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /dashboards/variables/
- pattern: /docs/grafana-cloud/
2024-06-21 22:02:16 +08:00
destination: /docs/grafana-cloud/visualizations/dashboards/variables/
2022-10-16 09:07:25 +08:00
---
# Dashboard URL variables
2024-07-15 21:36:10 +08:00
Dashboard URL [variables ](ref:variables ) allow you to provide more context when you share a dashboard URL.
For example, you could share a basic URL to your dashboard that looks like this:
```
https://${your-domain}/path/to/your/dashboard
```
This allows someone to navigate to the dashboard, but doesn't provide any helpful context that might be available.
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
Instead, you can add dashboard variables, passed as query parameters in the dashboard URL, to provide a URL like this:
```
https://${your-domain}/path/to/your/dashboard?var-example=value
```
This allows you to provide added context to the dashboard when someone navigates to it.
## Variables as query parameters
2022-10-16 09:07:25 +08:00
Grafana interprets query string parameters prefixed with `var-` as variables in the given dashboard.
2024-07-15 21:36:10 +08:00
For example:
2022-10-16 09:07:25 +08:00
```
https://${your-domain}/path/to/your/dashboard?var-example=value
```
2024-07-15 21:36:10 +08:00
In this URL, the query parameter `var-example=value` represents the dashboard variable `example` with a value of `value` .
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
### Multiple values for a variable
2022-10-16 09:07:25 +08:00
To pass multiple values, repeat the variable parameter once for each value:
```
https://${your-domain}/path/to/your/dashboard?var-example=value1& var-example=value2
```
Grafana interprets `var-example=value1&var-example=value2` as the dashboard variable `example` with two values: `value1` and `value2` .
### Example
2024-07-15 21:36:10 +08:00
[This dashboard in Grafana Play ](https://play.grafana.org/d/000000074/alerting?var-app=backend&var-server=backend_01&var-server=backend_03&var-interval=1h ) passes the variable `server` with multiple values, and the variables `app` and `interval` with a single value each.
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
## Ad hoc filters
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
Ad hoc filters apply key/value filters to all metric queries that use the specified data source. For more information, refer to [Add ad hoc filters ](ref:ad-hoc-filters ).
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
To pass an ad hoc filter as a query parameter, use the variable syntax to pass the ad hoc filter variable. Then provide the key, operator, and value as a pipe-separated list.
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
For example:
2022-10-16 09:07:25 +08:00
```
https://${your-domain}/path/to/your/dashboard?var-adhoc=example_key|=|example_value
```
2024-07-15 21:36:10 +08:00
In this URL, the query parameter `var-adhoc=key|=|value` applies the ad hoc filter configured as the `adhoc` dashboard variable using the `example_key` key, the `=` operator, and the `example_value` value.
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
{{< admonition type = "note" > }}
When sharing URLs with ad hoc filters, remember to encode the URL. In the preceding example, replace the pipes (`|`) with `%7C` and the equality operator (`=`) with `%3D` .
{{< / admonition > }}
2022-10-16 09:07:25 +08:00
### Example
2025-01-15 04:47:07 +08:00
[This dashboard in Grafana Play ](https://play.grafana.org/d/p-k6QtkGz/template-redux?var-interval=$__auto&orgId=1&from=now-5m&to=now&timezone=utc&var-query=$__all&var-query2=$__all&var-query3=$__all&var-Filters=job%7C%3D%7Cmetrictank%2Ftsdb-gw&var-textbox=foo&var-custom=lisa&var-datasource=grafanacloud-demoinfra-prom ) passes the ad hoc filter variable `Filters` with the filter value `job = metrictank/tsdb-gw` .
2024-07-15 21:36:10 +08:00
## Time range control using the URL
{{< docs / shared lookup = "dashboards/time-range-URLs.md" source = "grafana" version = "<GRAFANA_VERSION>" > }}
## Variables in dashboard links
When you create dashboard links the dashboard settings, you can have current dashboard variables included in the link by selecting that option:
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
{{< figure src = "/media/docs/grafana/dashboards/screenshot-dashboard-link-variables-11.1.png" max-width = "500px" alt = "Dashboard link page with variables option selected" > }}
2022-10-16 09:07:25 +08:00
2024-07-15 21:36:10 +08:00
For steps to add variables to dashboard links, refer to [Manage dashboard links ](ref:manage-dashboard-links ).