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

Torch Log Service

Copy page
Download PDF
SQL analysis API
ModifyScheduleSqlTask
Copy page
Download PDF
ModifyScheduleSqlTask
Use the ModifyScheduleSqlTask API to update scheduled SQL analysis tasks​
Request instructions​
  • Request method: PUT​
  • Request URL: https://{tls-endpoint}/ModifyScheduleSqlTask​
Request parameters​
The table below lists only the specific request parameters for this API and some common parameters For more information, see Common Parameters​
Body​
​
Parameter​
Type​
Required​
Example value​
Description​
TaskId​
String​
Yes​
4a9bd4bd-53f1-43ff-b88a-64ee1be5****​
Scheduled SQL analysis task ID.​
TaskName​
String​
No​
schedule-sql-task-name​
Name of the scheduled SQL analysis task. For naming conventions, see Resource Naming Rules.​
Description​
String​
No​
This is a test schedule sql task​
A brief description of the scheduled SQL analysis task​
  • Does not support <>、'、\、\\。​
  • Length must be between 0 and 64 characters.​
DestRegion​
String​
No​
cn-north-1​
Region where the target log topic is located​
DestTopicID​
String​
No​
2a9bd4bd-53f1-43ff-b88a-64ee1be5****​
Target log topic ID used to store SQL analysis result data.​
Status​
Integer​
No​
0​
Start the scheduled SQL analysis task immediately after configuring the task. Optional values:​
  • 0: Disable the task. You will need to start it manually later.​
  • 1: Start immediately.​
ProcessSqlDelay​
Integer​
No​
60​
Delay for each scheduling cycle. Valid range: 0–120 seconds.​
ProcessTimeWindow​
String​
No​
@m-15m,@m​
SQL time window. The time range for query and analysis of logs during scheduled SQL analysis tasks, using the left-closed, right-open format. For example, if a scheduled SQL analysis task starts at 10:00 on August 14, 2023, runs every 1 hour, with the SQL time window set as [@h-1h,@h) and a 10-second execution delay: after starting the task, TLS will create an instance at 10:00:00, start executing the instance at 10:00:10, and analyze log data from [09:00:00~10:00:00). At 11:00:00, a second instance will be created, execution begins at 11:00:10, and logs from [10:00:00~11:00:00) will be analyzed.​
tip​
The maximum SQL time window is 24 hours, and the minimum is 1 minute If the SQL time window is set to more than 24 hours, the execution may fail or the calculation may be inaccurate due to excessive data volume For the SQL time window syntax, see SQL time window syntax​
Query​
String​
No​
* | select *​
The scheduled SQL analysis task regularly executes query and analysis statements. These statements should follow the TLS query and analysis syntax. For detailed grammar instructions, see Query Overview and Analysis Overview.​
RequestCycle​
Object of RequestCycle​
No​
{"Type":"Period","Time":1}​
Scheduling cycle of the scheduled SQL analysis task The scheduling cycle determines the scheduling time for each instance​
  • Type: Scheduling cycle type Optional values:​
  • Period: Scheduled at regular intervals​
  • Fixed: Scheduled at a fixed time each day​
  • Time: The interval or fixed time for scheduling (minutes from 00:00), valid values are 1–1440, in minutes​
tip​
It is recommended that the scheduling interval is not shorter than the SQL time window to prevent scheduling delays and incorrect query results. For example, if the scheduling interval is set to every 10 minutes, the maximum SQL time window length is 10 minutes.​
​
RequestCycle​
​
Parameter​
Type​
Required​
Example value​
Description​
Time​
Integer​
Yes​
10​
The schedule interval or the specific time for regular execution (minutes from 00:00), ranging from 1 to 1440; unit: minute.​
Type​
String​
Yes​
Period​
Scheduling interval type. Optional values:​
  • Period: schedules tasks at regular intervals.​
  • Fixed: Scheduled at a regular interval, meaning it runs once every day at a fixed time.​
  • Cron: Uses Cron expressions.​
CronTab​
String​
No​
0 18 * * *​
Cron expression. TLS uses Cron expressions to schedule alert tasks. The minimum granularity for Cron expressions is minute, using the 24-hour format For example, 0 18 * * * means the alert task runs once every day at 18:00​
CronTimeZone​
String​
No​
GMT+0800​
When you set Type to Cron, you also need to set the time zone. For common time zones, see Select Time Zone.​
​
Return parameters​
This API does not provide unique return parameters. For more information, see Return structure.​
Sample request​
​
PUT https://{tls-endpoint}/ModifyScheduleSqlTask HTTP/1.1​
Content-Type: application/json​
{​
"TaskName": "test2",​
"Description": "This is a test schedule sql task",​
"TopicID": "c5c6b3a7-c730-4527-8d5f-e527b381****",​
"DestRegion": "cn-shanghai",​
"DestTopicID": "66b42cb6-3436-44ae-97bf-efab3043****",​
"Status": 1,​
"ProcessStartTime": 1689042649,​
"RequestCycle": {​
"Type": "Period",​
"Time": 1​
},​
"ProcessTimeWindow": "@m-m,@m",​
"Query": "",​
"ProcessSqlDelay": 0​
}​
​
Sample response​
​
HTTP/1.1 200 OK​
Content-Type: application/json; charset=utf-8​
​
Error Code​
The table below lists error codes related to this API's business logic. For public error codes, see the Public Error Code documentation.​
​
HTTP status code​
Error Code​
Error message​
Description​
400​
InvalidArgument​
Invalid argument key %s, value %s, please check argument.​
Invalid parameter.​
404​
ScheduleSqlTaskNotExist​
Task %s does not exist.​
Scheduled SQL analysis task does not exist.​
500​
InternalServerError​
We encountered an unexpected server error . Please try again later.​
Internal server error.​
​
Last updated: 2025.10.28 18:42:01