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

  1. In your Grafana instance, from the navigation menu, click Dashboards.
  2. Click the dashboard that you want to create a variable for, and then click the Dashboard settings icon (Dashboard settings icon).
  3. From the Settings menu, click Variables.
  4. 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
  5. Enter a name and description for the variable.
  6. Optional: In the Label field, enter a display name for the variable.
  7. In the Show on dashboard field, select Label and value, Value, or Nothing.
  8. In the Query options section, in the Data source field, select IBM® Security QRadar® AQL Plugin.
  9. Enter your AQL query and click Run Query.
    Variable queries are returned only in table result format.
  10. To extract part of a series or metric mode segment, enter an expression in the Regex field.
  11. From the Sort list, select how you want to sort the values of the variable.
  12. In the Refresh field, select On dashboard load or On time range change.
  13. 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.
  14. To save your changes and return to the Variables page, click Apply.
  15. 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 (Refresh dashboard icon).