Dashboard template variables apply a new scope to one or more widgets in your dashboard, allowing you to dynamically explore metrics across different sets of tags by using variables instead of specific tags.
New dashboards start with a keyless template variable applied. Click on the pencil icon to open the template variable edit mode:
Once in the edit mode click on Add Variable + to create your first Template Variable, it is defined by:
Tag or Attribute -required-:
Default Value -optional-: The default value for your template variable tag or attribute.
Once created, notice that you have statistics upon your template variables usage in your graphs. In the picture below, the template variable is not used in both graph of the dashboard:
Decide if you want to remove/add this template variable to all of your graph widgets with the respective Remove From All and Add to All buttons.
Template variables work with log and APM query based widgets because metrics, logs, and APM share the same tags.
Additionally, you can define log or APM template variables based on log or APM facets. These template variables start with
Note: Using the
Add to all button adds the template variable to all log/APM widgets.
Once you have defined a template variable, it appears in the options displayed in the
After the graph is saved, the value of this template variable is the one selected on top of your dashboard:
Even if the note widget doesn’t contain any graphs, you can display:
For instance, with the following note widget configuration:
dev value for the
$env template variable outputs the following result:
The event overlay search allows you to correlate metrics and events. Use template variables to find events that share certain tags with the metrics in your dashboard. The event overlay search is applied through an individual graph.
Values from dashboard template variables can be directly captured by using the
$<TEMPLATE_VARIABLE_KEY>.value syntax in the event search field.
Note: Dashboard template variables must be metric tags; event-supplied tags cannot be used as dashboard template variables.
For example, to search for events in the event stream with the same region tag, use:
In the following example, the template variable resolves to
tags:region:ap-south-1. After those events are brought up in the event search overlay, the timing of the events are marked by pink bars in the graphs to show the timing of events:
Use multiple template variables in the search field to display all corresponding events tagged. The following example uses the query
$<TEMPLATE_VARIABLE_KEY>.value syntax to capture the resolved
key:value from a given template variable and use it with other filters.
Find below an example that uses the
env tags together with the
tag in the search term
Additional helpful documentation, links, and articles: