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

Torch Log Service

Copy page
Download PDF
Data backflow API
CreateLogBackFlowTask
Copy page
Download PDF
CreateLogBackFlowTask
seeCall the CreateLogBackFlowTask API to create a log data backflow task.​
Request instructions​
  • Request method: POST​
  • Request URL: https://{tls-endpoint}/CreateLogBackFlowTask​
Request parameters​
The table below lists parameters unique to this API and some common parameters. For more information, see Common parameters.​
Body​
​
Parameters​
Type​
Required​
Example value​
Description​
BackFlowEndTime​
Integer​
No​
1735747200​
End time for the backflow task, measured in seconds. If set to nil, the task will continue without a specific end time.​
BackFlowStartTime​
Integer​
No​
1735660800​
The start time of the backflow task, in seconds.​
Description​
String​
No​
This is a test log data backflow task description​
Task description provides detailed information about the purpose or content of the log backflow task. Description must meet the following requirements:​
  • Special characters such as <, >, ', \, and ; are not supported.​
  • Length must be between 0 and 64 characters.​
IamProjectName​
String​
No​
default​
Name of the access control project.​
LogBackFlowTaskSource​
Yes​
/​
Data source information for TLS log backflow tasks, including the data source type and specific configuration.​
QueryParams​
Object of QueryParams​
Yes​
/​
Timed SQL field configuration, used to specify sorting, filtering, and returned fields when querying logs.​
ScheduleSqlTaskInfo​
Object of ScheduleSqlTaskInfo​
No​
/​
Configuration information for scheduled SQL tasks, including target topic details, execution cycle, timeout period, and more.​
ShipperToTosInfo​
Object of ShipperToTosInfo​
No​
/​
Delivery task configuration, used to specify parameters related to log delivery in a log data ingestion task.​
If left empty, no delivery will be made.​
TaskName​
String​
Yes​
log-data-backflow-task-name​
Name of the log backflow task.​
​
LogBackFlowTaskSource​
​
Parameters​
Type​
Required​
Example value​
Description​
SourceType​
String​
No​
Topic​
The data source type for log replay tasks specifies the source type of the replay task​
LogBackFlowTaskTopicSource​
No​
/​
The data source configuration for log callback tasks includes the log topic ID and the corresponding project ID.​
​
QueryParams​
​
Parameters​
Type​
Required​
Example value​
Description​
Asc​
Boolean​
No​
true​
Specify whether the query results are sorted in ascending order.​
  • true: Indicates sorting in ascending order.​
  • false: Indicates sorting in descending order.​
Limit​
Integer​
No​
100​
Set the maximum number of log entries returned when querying logs​
Order​
String​
No​
Start​
Specify the sorting field for query logs. If left blank, logs are sorted by the Start field by default.​
Fields​
Array of Field​
No​
/​
Specifies the list of fields to return for log queries. If not specified, all fields are returned.​
Filters​
Array of Filter​
No​
/​
Specify the filter conditions for query logs. The default relationship between multiple conditions is AND.​
​
ScheduleSqlTaskInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
DestRegion​
String​
No​
cn-north-1​
The area where the target topic is located. If not specified, the default is the current region.​
MaxTimeout​
Integer​
No​
300​
The maximum timeout for scheduled SQL tasks, measured in seconds​
DestTopicID​
String​
Yes​
2a9bd4bd-53f1-43ff-b88a-64ee1be5****​
Target log topic ID for timed SQL tasks. This specifies where the SQL query results are written.​
RequestCycle​
Object of RequestCycle​
No​
/​
The execution cycle of query or analysis requests.​
MaxRetryTimes​
Integer​
No​
3​
Maximum retry attempts when a scheduled SQL task fails, with a default value of 3.​
ProcessSqlDelay​
Integer​
No​
60​
Query latency for scheduled SQL tasks, measured in seconds.​
ProcessTimeWindow​
String​
No​
@m-15m,@m​
Schedule window expression for specifying the execution window of scheduled SQL tasks This expression defines the start and end times of tasks using a specific format​
​
ShipperToTosInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
ContentInfo​
Object of ContentInfo​
No​
/​
Configure the content format of delivery logs.​
TosShipperInfo​
Object of TosShipperInfo​
No​
/​
Delivery configuration information for TOS, including bucket name, prefix directory, compression format, and more.​
​
LogBackFlowTaskTopicSource​
​
Parameters​
Type​
Required​
Example value​
Description​
TopicID​
String​
No​
0fdaa6b6-3c9f-424c-8664-fc0d222c****​
Log topic ID.​
ProjectId​
String​
No​
c7e0e442-19bf-4fb3-b547-5992fb8b****​
The log topic belongs to the log project ID.​
​
Field​
​
Parameters​
Type​
Required​
Example value​
Description​
Alias​
String​
No​
user_name​
Field alias used to replace the original field name in query results. When querying logs, the returned results will display this alias as the field name.​
Column​
String​
No​
user_name​
Specify the field names to be returned during log queries to filter specific fields that must be included in the logs.​
​
Filter​
​
Parameters​
Type​
Required​
Example value​
Description​
Field​
String​
No​
status​
Specifies the field name used as the base field for filtering log queries. This field serves as the filtering criterion.​
Value​
Object of Value​
No​
/​
Specifies the single value for comparison operators in log query filters.​
Values​
Array of String​
No​
["200","404","500"]​
Used to specify a list of multiple values for the IN or NOT IN operators in log queries. If Operator is IN or NOT IN, this field is required.​
Operator​
String​
No​
=​
Used to specify comparison operators in log query filtering conditions. The supported values are listed below.​
  • >: Greater than;​
  • <: Less than;​
  • =: Equal to;​
  • IN: Included in the specified value list;​
  • NOT IN: Not included in the specified list of values​
  • NULL: The field is empty​
  • NOT NULL: The field is not empty​
​
RequestCycle​
​
Parameters​
Type​
Required​
Example value​
Description​
Time​
Integer​
Yes​
10​
The scheduling cycle or scheduled execution time (minutes from 00:00). Valid values are 1–1440; unit: minutes.​
Type​
String​
Yes​
Period​
Scheduling cycle type. Optional values:​
  • Period: Schedule by cycle, meaning tasks are run at regular intervals.​
  • Fixed: Schedule at a specific time each day.​
  • Cron: Use a Cron expression.​
CronTab​
String​
No​
0 18 * * *​
Cron expression: TLS uses Cron expressions to schedule alert tasks The minimum interval for Cron expressions is one minute, based on a 24-hour clock For example, 0 18 * * * means the alert task runs once every day at 18:00​
CronTimeZone​
String​
No​
GMT+0800​
Set Type to Cron and configure the time zone. For common time zones, see Select Time Zone.​
​
ContentInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
Format​
String​
No​
json​
Log content parsing format​
  • When delivering to TOS, supports configuring as json, jsonl, or csv​
  • When delivering to Kafka, supports configuring as original or json​
CsvInfo​
Object of CsvInfo​
No​
/​
CSV format log content configuration.​
JsonInfo​
Object of JsonInfo​
No​
/​
Configure log content in JSON or JSONL format.​
​
TosShipperInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
Bucket​
String​
Yes​
mytos​
Select a TOS bucket. It must be in the same region as the source log topic.​
  • Only numbers, hyphens (-), and letters a-z are allowed.​
  • Start and end with a number or letter.​
  • The length must be between 3 and 63 characters.​
Prefix​
String​
No​
testprefix​
Top-level directory name of the bucket. All log data delivered by this delivery configuration will be delivered to this directory.​
  • Cannot start with a forward slash (/) or backslash (\), and consecutive forward slashes (/) are not allowed.​
  • Cannot start with .. as a folder name.​
  • Folder names must be unique in the same bucket.​
MaxSize​
Integer​
No​
5​
The maximum size of raw files that can be delivered for each shard, which refers to the uncompressed log file size. The unit is MiB. The value range is 5–256.​
Compress​
String​
No​
snappy​
Compression format. Currently supports snappy, gzip, lz4, and none.​
Interval​
Integer​
No​
300​
Delivery interval (seconds), range: 300–900.​
PartitionFormat​
String​
No​
%Y/%m/%d/%H/%M​
The rule for sharding delivery logs.​
  • The naming format of subdirectories supports strftime syntax. The default setting is %Y/%m/%d/%H/%M, for example, 2022/06/30/14/00.​
  • It cannot start with forward slashes ( / ) or backslashes ( \ ).​
​
CsvInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
Keys​
Array of String​
Yes​
["user","log","ip"]​
Configure the fields required for delivery.​
  • Only letters, numbers, and _-./ are supported, and the name cannot start with _.​
  • The key name must be unique within the same index.​
  • Length must be between 1 and 128 characters.​
Delimiter​
String​
Yes​
,​
Separator. Comma, tab, vertical bar, semicolon, and space are supported.​
EscapeChar​
String​
Yes​
false​
Escape character: when the field contains a separator, wrap the field with the escape character. Currently, only single quotes, double quotes, and empty characters are supported.​
PrintHeader​
Boolean​
Yes​
false​
Print Key in the first row.​
NonFieldContent​
String​
Yes​
test​
Invalid field fill content. The length must be 0 to 128 characters.​
​
JsonInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
Keys​
Array of String​
No​
["__content", "pod_name"]​
When delivering in JSON or JSONL format, if this parameter is not configured, all fields are delivered, including __content__ (required), __source__, __path__, __time__, __image_name__, __container_name__, __pod_name__, __pod_uid__, namespace, __tag____client_ip__, and __tag____receive_time__.​
Enable​
Boolean​
Yes​
true​
Enable flag.​
Escape​
Boolean​
No​
true​
Escape characters Must be set to true​
​
Response parameters​
The table below only lists response parameters specific to this interface. For more information, see Response structure.​
​
Parameters​
Type​
Example value​
Description​
TaskId​
String​
d4bd-53f1-43ff-b88a-64ee1be5****​
The unique identifier returned after creating a log backflow task, used to operate or query the task later.​
​
Sample request​
​
POST https://{tls-endpoint}/CreateLogBackFlowTask HTTP/1.1​
Content-Type: application/json​
{​
"BackFlowEndTime": 1735747200,​
"BackFlowStartTime": 1735660800,​
"Description": "This is a test log data backflow task description",​
"IamProjectName": "default",​
"LogBackFlowTaskSource": {​
"SourceType": "Topic",​
"LogBackFlowTaskTopicSource": {​
"TopicID": "0fdaa6b6-3c9f-424c-8664-fc0d222c****",​
"ProjectId": "c7e0e442-19bf-4fb3-b547-5992fb8b****"​
}​
},​
"QueryParams": {​
"Asc": true,​
"Limit": 100,​
"Order": "Start",​
"Fields": [​
{​
"Alias": "user_name",​
"Column": "user_name"​
}​
],​
"Filters": [​
{​
"Field": "status",​
"Value": "200",​
"Values": [​
"200",​
"404",​
"500"​
],​
"Operator": "="​
}​
]​
},​
"ScheduleSqlTaskInfo": {​
"DestRegion": "cn-north-1",​
"MaxTimeout": 300,​
"DestTopicID": "2a9bd4bd-53f1-43ff-b88a-64ee1be5****",​
"RequestCycle": {​
"Time": 10,​
"Type": "Period",​
"CronTab": "0 18 * * *",​
"CronTimeZone": "GMT+0800"​
},​
"MaxRetryTimes": 3,​
"ProcessSqlDelay": 60,​
"ProcessTimeWindow": "@m-15m,@m"​
},​
"ShipperToTosInfo": {​
"ContentInfo": {​
"Format": "json",​
"CsvInfo": {​
"Keys": [​
"user",​
"log",​
"ip"​
],​
"Delimiter": " ",​
"EscapeChar": "false",​
"PrintHeader": false,​
"NonFieldContent": "test"​
},​
"JsonInfo": {​
"Keys": [​
"__content",​
"pod_name"​
],​
"Enable": true,​
"Escape": true​
}​
},​
"TosShipperInfo": {​
"Bucket": "mytos",​
"Prefix": "testprefix",​
"Region": "cn-beijing",​
"MaxSize": 5,​
"Compress": "snappy",​
"Endpoint": "https://ep-xxxx.tos.cn-beijing.privatelink.volces.com",​
"Interval": 300,​
"ProxyPoint": "custom1",​
"PartitionFormat": "%Y/%m/%d/%H/%M"​
}​
},​
"TaskName": "log-data-backflow-task-name"​
}​
​
Sample response​
​
Content-Type: application/json; charset=utf-8​
{​
"TaskId": "d4bd-53f1-43ff-b88a-64ee1be5****"​
}​
​
Error Code​
You can see Common error codes to learn more about error codes.​
Last updated: 2026.02.13 17:42:15