- Documentation
Torch Log Service
User Guide
Visualization
Add dashboard filters and variables
Add custom variables to dashboard
Add dashboard filters and variables
Add custom variables to dashboard
Add custom variables to dashboard
This topic describes how to add custom variables to a dashboard and provides related examples.
Prerequisites
- Log data has been collected and indexes are configured. For more details, see Collect log data.
Notice
The total number of filters, variables, and charts in each dashboard must not exceed 50.
Steps to add custom variables
- Select the region where log service is located from the top navigation bar.
- In the left navigation bar, select Common functions > Dashboard.
- In the dashboard list, click the dashboard under the target project.
- Click the settings icon in the upper right corner of the page.
-
- On the Filters and variables tab, click Add custom variable.
- In the Add custom variables panel, configure the following parameters, click Create variables, and then click Save.
Example: Add a time interval variable
For example, Chart A displays the number of requests per minute. When you need to view website traffic at different time intervals (such as per second, per hour, etc.), you can manually add a time interval variable placeholder in the query and analysis statement. Then, use the variable to filter chart data.
- Add chart A to the dashboard before adding custom variables. For detailed instructions, see Add charts to dashboard. The query and analysis statement for chart A is as follows:
Notice
__time__ is a timestamp in milliseconds. Therefore, DATE_FORMAT(__time__ - __time__ % 60000, 'HH:mm:ss') means that the time will be aligned to the nearest minute.
-
- Edit the query and analysis statement for chart A and add a variable placeholder ${{interval|60000}} in the statement.
-
- Here are examples of important configuration items:
- Set variable name to interval.
- Set variable alias (display name) to Time interval.
- Set static value of field to 3600000, 60000, and 1000, representing intervals of per hour, per minute, and per second respectively.
-
- At the top right of the Settings page, click Save.
-
- After you add a variable, a variable selection box is displayed in the dashboard. You can filter chart data using the variable selection box. For example, if you select time interval as hour, Chart A displays the number of website visits each hour.
-
After you add filters and variables, you can use them in the dashboard, or you can modify and delete them as needed. For details, see Common dashboard actions.
Last updated: 2026.03.11 18:49:43