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 select sourceip from events limit 10
SELECT sourceip, COUNT(*) as countfield FROM events where sourceip in ('$sourceip') GROUP BY sourceip ORDER BY countfield DESC LIMIT 10
Custom select sourceip from events limit 10
SELECT sourceip, COUNT(*) as countfield FROM events where sourceip == ('$custom_sourceip') GROUP BY sourceip ORDER BY countfield DESC LIMIT 10
Text box text_sourceip
SELECT sourceip, COUNT(*) as countfield FROM events where sourceip == ('$text_sourceip') GROUP BY sourceip ORDER BY countfield DESC LIMIT 10
- 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 IBM® Security QRadar® AQL Plugin.
- Enter your AQL 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 ().