Configuring a dashboard variable
Configure a dashboard variable in your panel queries to dynamically change your data visualization. Query variable results are displayed in a dashboard drop-down list. You can also manually enter text box variables in a dashboard text box.
Procedure
- In your Grafana instance, from the navigation menu, click Dashboards.
- Click the dashboard that you want to create a variable for, and then click the
Dashboard settings icon (
).
- From the Settings menu, click Variables.
- On the Variables page, click New variable,
and then select a variable type. If your dashboard contains variables, click Add
variable, and then select a variable type.
Table 1. Variable types and supported formats Variable type Example Query usage Query users=events| project username=user_id
events | project original_time,username=user_id | where $__timeFilter(original_time) and username in ('$users') | summarize Events=dcount(username)
Custom custom_users=qradar,qradar1
events | project original_time,username=user_id | where $__timeFilter(original_time) and username == '$custom_users' | summarize Events=dcount(username)
Text box text_users
events | project original_time,username=user_id | where $__timeFilter(original_time) and username == '$text_users' | summarize Events=dcount(username)
Interval (seconds) custom_time=60,600,1800,3600
events | project original_time,username=user_id | where $__timeFilter(original_time) | summarize Events=dcount(username) by bin(original_time,$custom_time)
- Enter a name and description for the variable.
- Optional: In the Label field, enter a display name for the variable.
- In the Show on dashboard field, select Label and value, Value, or Nothing.
- In the Query options section, in the Data source field, select QRadar® Suite KQL Plugin.
- Enter your KQL query and click Run Query. Variable queries are returned only in table result format.
- To extract part of a series or metric mode segment, enter an expression in the Regex field.
- From the Sort list, select how you want to sort the values of the variable.
- In the Refresh field, select On dashboard load or On time range change.
- In the Selection options section, select one or more of the
following options:
- To enable multiple variable values to be selected at the same time, select the Multi-value checkbox.
- To enable a drop-down list that includes all variable values, select the Include All option checkbox. If you select this option, leave the Custom all value field blank. If you enter a value in the Custom all value field, your query values are formatted into a single string.
- To save your changes and return to the Variables page, click Apply.
- Click Save dashboard. Your dashboard variable is displayed on your dashboard page. The query results are displayed as values in a drop-down list. You can search for a value in the Enter variable value field.Important: To refresh your dashboard panels after you select a variable, click outside the field or click the Refresh dashboard icon (
).