- Documentation
Torch Log Service
User Guide
Query and analysis
Associate external data source for log query
MySQL join query and analysis
Associate external data source for log query
MySQL join query and analysis
MySQL join query and analysis
After creating a MySQL data source association in TLS, you can run join query and analysis on log topic plus the MySQL database. You can also insert the query and analysis results into the MySQL database. This topic describes the steps and examples for join query and analysis.
The MySQL data source association has been created, and the data source connection status is successful. For details on how to create a data source association and check the connection status, see Associate to MySQL data source. - Select the region where log service is located from the top navigation bar.
- In the left navigation bar, select Common functions > Query and analysis.
- On the page Query and analysis and in the list of left pane, select the specified project and topic.
- On the query and analysis page for the specified log topic, set the time range.
- By default, the time range is 5 minutes. You can also customize the time range for query.
- Enter the query and analysis condition to execute a joint query analysis.
- When performing joint query analysis, use the JOIN clause to connect log topics with the designated external data resource. For supported JOIN syntax, see JOIN clause.
Notice
Pay attention to the relevant limits on MySQL table size and SQL syntax when performing query and analysis. For more details, see Notice. - For example, after creating an external MySQL data resource named tls_join_meta_store, use JOIN syntax for joint analysis between log topics and the MySQL database. During joint analysis, associate the userid field of the current log topic with the uid field in the specified data source to analyze activity levels across different age groups. Example of join query and analysis is as follows.
- Enter the query and analysis statement and save the query results to the MySQL database.
- Use the INSERT statement to save the query results from the previous step into an existing table in the database. The sample SQL statement is as follows. After successful execution, you can view the saved query and analysis results in the MySQL database.
Last updated: 2025.12.31 17:23:43