You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
Add dashboard filters and variables
Add dashboard data source variables
Copy page
Download PDF
Add dashboard data source variables
This topic explains how to add dashboard data source variables and provides relevant 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 data source variables​
  1. Log in to TLS console.​
  1. Select the region where log service is located from the top navigation bar.​
  1. In the left navigation bar, select Common functions > Dashboard.​
  1. In the dashboard list, click the dashboard under the target project.​
  1. Click the Settings icon in the upper right corner of the page.​
  • ​​​
  1. On the Filters and variables tab, click Add datasource variable.​
  1. In the Create datasource variables panel, configure the following parameters, click Create datasource variables, and then click Save.​
  • ​
    Configuration​
    Description​
    Data source variable name​
    Data source variable name.​
    The log service uses this variable as the key for filtering conditions, which takes effect on the statistical charts in the dashboard that have this variable configured.​
    Alias (display name)​
    Alias for the variable name. For example, you can set an alias Client IP for the variable clientIP to enhance the dashboard experience.​
    Topic type​
    It is used to specify the topic type of the data source; supports log topics and metric topics.​
    Notice​
    Metric topic is now in closed beta. If you have business needs, contact your account manager for allowlist access.​
    Option source​
    It is used to specify the data source range; supports selecting all log/metric topics or customizing log/metric topics.​
    • All log/metric topics: Includes all log/metric topics in the project where the current dashboard is located.​
    • Custom log/metric topics: You can select log/metric topics in the current dashboard's project as needed.​
    • You can use regular expressions to match target log/metric topics.​
    Default log/metric topics​
    Specify the log/metric topics to use by default.​
    ​
Example: Add multiple topic request count variables​
For example, project A may have multiple topics and each topic stores access logs for websites A, B, C, and others. When you need to display the number of requests per minute for each log topic using a chart, you can add a data source variable.​
  1. Add a data source variable.​
  • Here are examples of important configuration items:​
  • Set Data source variable name as website.​
  • Set alias (display name) as Website access logs.​
  • Set Option source as All topics.​
  • ​​​
  1. Save configurations.​
  • At the top right of the Settings page, click Save.​
  • ​​​
  1. Add a chart.​
  • Add chart A to the dashboard. For details, see Add charts to dashboard. Set the data source to data source variable and website access logs (\${{website}}). The corresponding query and analysis statement is as follows:​
  • ​
    * | SELECT DATE_FORMAT(__time__ - __time__ % 60000, 'HH:mm:ss') AS time, count(*) AS PV GROUP BY time ORDER BY time​
    ​
Notice​
  • __time__ is a millisecond-level timestamp, so DATE_FORMAT(__time__ - __time__ % 60000, 'HH:mm:ss') aligns the time to the minute.​
  • After selecting a data source variable, the system will query and analyze based on the log topic you specified when adding the variable, and then generate the result.​
  • ​​​
  1. Use a data source variable.​
  • After the variable is added, a variable selection box will show in the dashboard. You can switch the data source (log topic) through the box. For example, when you select different log topics within the website access logs variable, the system automatically updates the query and analysis results based on your selected log topic.​
  • ​​​
Related operations​
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.12 16:35:51