Create Task CreateTask

BLS

  • Function Release Records
  • Product Description
    • Usage restrictions
    • Product Introduction
  • Product pricing
  • Quick Start
    • Introduction
    • Install agent
    • Create LogStore
    • Create Transmission Task
    • Log Analysis and Alerting
    • Create Delivery Task
  • Operation guide
    • Baidu Intelligent Cloud Environment Preparation
    • Overview
    • Identity and access management
    • Logset Management
    • Agent
      • Install Agent on Host
      • Install Agent in K8s Environment
      • Agent Management
      • Agent Release Version
      • Set Agent Startup Parameters
    • Log Collection
      • Transmission Task Collection
        • Create Transmission Task
        • Manage Transmission Task
      • Uploading Logs Using Kafka Protocol
    • Query analysis
      • Log query
      • SQL Syntax
      • Search Syntax
    • Dashboard
      • Overview
      • Management Dashboard
      • Management Dashboard Charts
    • Alarm management
      • Alert Overview
      • Alarm strategy
        • Management alarm strategy
        • Trigger conditions
      • Alarm history
      • Alert execution statistics
      • Alarm notification
        • Alarm Notification Template
        • Alarm callback
    • Data processing
      • Log Delivery
        • Log Delivery Overview
        • Create Delivery Task
        • Manage Delivery Task
      • Scheduled SQL Analysis
        • Manage Scheduled SQL Analysis Task
        • Create Scheduled SQL Analysis Task
      • Real-Time Consumption
      • Data processing
        • Data processing
          • Overview of data processing functions
          • Process control function
          • Mapping enrichment functions
          • Event operation functions
          • Field operation functions
          • Field value extraction functions
    • Log Applications
      • Intelligent Diagnostics
  • Best Practices
    • Use Year-Over-Year and Month-Over-Month as Alert Trigger Conditions
    • BLS Integration with Kibana
    • Use BLS via Grafana
  • Development Guide
    • API Reference
      • API function release records
      • API Overview
      • Interface Overview
      • General Description
      • Service domain
      • Common error codes
      • Terminology
      • Project Related APIs
        • Create Project
        • Update Project
        • Describe Project
        • Delete Project
        • List Project
      • LogStore Related APIs
        • Create LogStore
        • Update LogStore
        • Delete LogStore
        • Describe LogStore
        • Batch Get LogStore
        • List LogStore
      • LogStream Related APIs
        • List LogStream
      • LogRecord Related APIs
        • Push log PushLogRecord
        • Obtain logrecord PullLogRecord
        • Search analysis log QueryLogRecord
        • Histogram API QueryLogHistogram
      • Fast Query FastQuery Related Interfaces
        • Create Fast Query CreateFastQuery
        • Update Fast Query UpdateFastQuery
        • Delete Fast Query DeleteFastQuery
        • Get Fast Query Details DescribeFastQuery
        • Get Fast Query List ListFastQuery
      • Index Related APIs
        • Create Index
        • Update Index
        • Delete Index
        • Describe Index
      • Log Shipper LogShipper Related Interfaces
        • Create Log Shipper
        • Update Log Shipper
        • Set Single Log Shipper Status
        • Delete Single Log Shipper
        • Bulk Delete Log Shipper
        • List Log Shipper Records
        • List Log Shipper
        • Bulk Set Log Shipper Status
        • Get Log Shipper
      • Alarm-Related Interfaces
        • CreateAlarmPolicy
        • UpdateAlarmPolicy
        • DeleteAlarmPolicy
        • ValidateAlarmCondition
        • ValidateAlarmPolicySQL
        • EnableAlarmPolicy
        • DescribeAlarmRecord
        • DisableAlarmPolicy
        • DescribeAlarmPolicy
        • ListAlarmPolicy
        • ListAlarmRecord
        • ListAlarmExecutionStats
        • ListAlarmExecutions
      • LogStore Template-Related Interfaces
        • CreateLogStoreTemplate
        • UpdateLogStoreTemplate
        • DeleteLogStoreTemplates
        • DescribeLogStoreTemplates
        • DescribeLogStoreTemplate
      • Download Log Download Related Interfaces
        • Create Download Task CreateDownloadTask
        • Get Download Task List ListDownloadTask
        • Delete Download Task DeleteDownloadTask
        • Get Download Task Address GetDownloadTaskLink
        • Get Download Task Details DescribeDownloadTask
      • LogAlarm Related Interfaces
        • SetLogAlarmStatus
        • deleteLogAlarm
        • createLogAlarm
        • listLogAlarm
        • updateLogAlarm
        • BulkDeleteLogAlarm
        • PreviewAlarmLogRecord
        • getLogAlarm
        • BulkSetLogAlarmStatus
      • Transmission Task Related Interfaces
        • Create Task CreateTask
        • UpdateTask
      • Interfaces Compatible with Elasticsearch
        • ResolveIndex
        • FieldCaps
        • TermsEnum
        • AsyncSearch
    • SDK Reference
      • Go SDK
        • Overview
        • Initialization
        • Version Release Records
        • Project Operations
        • LogStore Operations
        • Install the SDK Package
        • LogStream Operations
        • LogRecord Operations
        • FastQuery Operations
        • LogShipper Operations
        • Index Operations
        • Download Task Operations
      • Java SDK
        • Overview
        • Install the SDK Package
        • LogRecord Operations
      • iOS SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android & iOS SDK Download
      • SDK Privacy Policy
      • SDK Developer Personal Information Protection Compliance Guide
    • Importing SLS Collection Configuration
  • FAQs
    • Common Questions Overview
    • Fault-related questions
    • Configuration-related questions
  • Log Service Level Agreement SLA
All documents
menu
No results found, please re-enter

BLS

  • Function Release Records
  • Product Description
    • Usage restrictions
    • Product Introduction
  • Product pricing
  • Quick Start
    • Introduction
    • Install agent
    • Create LogStore
    • Create Transmission Task
    • Log Analysis and Alerting
    • Create Delivery Task
  • Operation guide
    • Baidu Intelligent Cloud Environment Preparation
    • Overview
    • Identity and access management
    • Logset Management
    • Agent
      • Install Agent on Host
      • Install Agent in K8s Environment
      • Agent Management
      • Agent Release Version
      • Set Agent Startup Parameters
    • Log Collection
      • Transmission Task Collection
        • Create Transmission Task
        • Manage Transmission Task
      • Uploading Logs Using Kafka Protocol
    • Query analysis
      • Log query
      • SQL Syntax
      • Search Syntax
    • Dashboard
      • Overview
      • Management Dashboard
      • Management Dashboard Charts
    • Alarm management
      • Alert Overview
      • Alarm strategy
        • Management alarm strategy
        • Trigger conditions
      • Alarm history
      • Alert execution statistics
      • Alarm notification
        • Alarm Notification Template
        • Alarm callback
    • Data processing
      • Log Delivery
        • Log Delivery Overview
        • Create Delivery Task
        • Manage Delivery Task
      • Scheduled SQL Analysis
        • Manage Scheduled SQL Analysis Task
        • Create Scheduled SQL Analysis Task
      • Real-Time Consumption
      • Data processing
        • Data processing
          • Overview of data processing functions
          • Process control function
          • Mapping enrichment functions
          • Event operation functions
          • Field operation functions
          • Field value extraction functions
    • Log Applications
      • Intelligent Diagnostics
  • Best Practices
    • Use Year-Over-Year and Month-Over-Month as Alert Trigger Conditions
    • BLS Integration with Kibana
    • Use BLS via Grafana
  • Development Guide
    • API Reference
      • API function release records
      • API Overview
      • Interface Overview
      • General Description
      • Service domain
      • Common error codes
      • Terminology
      • Project Related APIs
        • Create Project
        • Update Project
        • Describe Project
        • Delete Project
        • List Project
      • LogStore Related APIs
        • Create LogStore
        • Update LogStore
        • Delete LogStore
        • Describe LogStore
        • Batch Get LogStore
        • List LogStore
      • LogStream Related APIs
        • List LogStream
      • LogRecord Related APIs
        • Push log PushLogRecord
        • Obtain logrecord PullLogRecord
        • Search analysis log QueryLogRecord
        • Histogram API QueryLogHistogram
      • Fast Query FastQuery Related Interfaces
        • Create Fast Query CreateFastQuery
        • Update Fast Query UpdateFastQuery
        • Delete Fast Query DeleteFastQuery
        • Get Fast Query Details DescribeFastQuery
        • Get Fast Query List ListFastQuery
      • Index Related APIs
        • Create Index
        • Update Index
        • Delete Index
        • Describe Index
      • Log Shipper LogShipper Related Interfaces
        • Create Log Shipper
        • Update Log Shipper
        • Set Single Log Shipper Status
        • Delete Single Log Shipper
        • Bulk Delete Log Shipper
        • List Log Shipper Records
        • List Log Shipper
        • Bulk Set Log Shipper Status
        • Get Log Shipper
      • Alarm-Related Interfaces
        • CreateAlarmPolicy
        • UpdateAlarmPolicy
        • DeleteAlarmPolicy
        • ValidateAlarmCondition
        • ValidateAlarmPolicySQL
        • EnableAlarmPolicy
        • DescribeAlarmRecord
        • DisableAlarmPolicy
        • DescribeAlarmPolicy
        • ListAlarmPolicy
        • ListAlarmRecord
        • ListAlarmExecutionStats
        • ListAlarmExecutions
      • LogStore Template-Related Interfaces
        • CreateLogStoreTemplate
        • UpdateLogStoreTemplate
        • DeleteLogStoreTemplates
        • DescribeLogStoreTemplates
        • DescribeLogStoreTemplate
      • Download Log Download Related Interfaces
        • Create Download Task CreateDownloadTask
        • Get Download Task List ListDownloadTask
        • Delete Download Task DeleteDownloadTask
        • Get Download Task Address GetDownloadTaskLink
        • Get Download Task Details DescribeDownloadTask
      • LogAlarm Related Interfaces
        • SetLogAlarmStatus
        • deleteLogAlarm
        • createLogAlarm
        • listLogAlarm
        • updateLogAlarm
        • BulkDeleteLogAlarm
        • PreviewAlarmLogRecord
        • getLogAlarm
        • BulkSetLogAlarmStatus
      • Transmission Task Related Interfaces
        • Create Task CreateTask
        • UpdateTask
      • Interfaces Compatible with Elasticsearch
        • ResolveIndex
        • FieldCaps
        • TermsEnum
        • AsyncSearch
    • SDK Reference
      • Go SDK
        • Overview
        • Initialization
        • Version Release Records
        • Project Operations
        • LogStore Operations
        • Install the SDK Package
        • LogStream Operations
        • LogRecord Operations
        • FastQuery Operations
        • LogShipper Operations
        • Index Operations
        • Download Task Operations
      • Java SDK
        • Overview
        • Install the SDK Package
        • LogRecord Operations
      • iOS SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android & iOS SDK Download
      • SDK Privacy Policy
      • SDK Developer Personal Information Protection Compliance Guide
    • Importing SLS Collection Configuration
  • FAQs
    • Common Questions Overview
    • Fault-related questions
    • Configuration-related questions
  • Log Service Level Agreement SLA
  • Document center
  • arrow
  • BLS
  • arrow
  • Development Guide
  • arrow
  • API Reference
  • arrow
  • Transmission Task Related Interfaces
  • arrow
  • Create Task CreateTask
Table of contents on this page
  • Description
  • Request
  • Response
  • Error code
  • Example

Create Task CreateTask

Updated at:2025-11-03

Description

Create BLS log collection and transmission tasks

Request

  • Request syntax
Text
1POST /task HTTP/1.1
2Host: <Endpoint>
3Authorization: <Authorization String>
4Content-Type: application/json; charset=utf-8
5{
6  "name": <name>,
7  "config": <TaskConfig>,
8  "hosts": List<Host>,
9  "tags": List<Tag>
10}
  • Request headers

No additional headers are required beyond the standard request headers.

  • Request parameters
Parameter name Types Required or not Parameter location Description
name String Yes RequestBody Transmission task name
config TaskConfig Yes RequestBody Task configuration
hosts List<Host> Yes RequestBody List of task running hosts
tags List<Tag> No RequestBody For the tag list to create, see below for specific parameter formats
  • Host
Parameter name Types Description
hostId String Host ID
  • Tag
Parameter name Types Description
tagKey String The key of the tag, which main contain uppercase and lowercase letters, numbers, Chinese characters, and special characters-_ /., with a length of 1-65.
tagValue String The value of the tag, which main contain uppercase and lowercase letters, numbers, Chinese characters, and special characters-_ /., with a length of 0-65.
  • TaskConfig
Parameter name Types Description
srcConfig SrcConfig Data source location configuration
destConfig DestConfig Destination location configuration
  • SrcConfig
Parameter name Types Description
srcType String For host type, enter 'host'; for container type, enter 'container'. (Sidecar mode operates in host mode, and therefore enter 'host'.)
srcDir String Source Log Directory: Use glob mode for matching. For multiple directories, separate them with an English semicolon (;).
matchedPattern String Source log files, matched by regular expression
ignorePattern String Ignored source log file
timeFormat String For BOS delivery, process the source file path and date
ttl Int Valid log file time range
useMultiline Bool Whether the multi-line mode is enabled
multilineRegex String Multi-line mode; the first line in regular expression
recursiveDir Bool Whether the directory recursion matching is enabled; no directory recursion is added for container collection
processType String Processing type, options: none (no processing), json (processed by JSON format), separator (processed by separator), regex (processed by regular expression), kv (processed by key value pair)
processConfig ProcessConfig Detailed configuration of data processing
logTime String Log time, options: system and logTime, indicating the use of system time and the use of log time respectively
timestampKey String Specify the processed field to serve as log time
dateFormat String Specify the time processing format of timestamp field; format shall refer to https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
filterExpr String Log matching expression; only logs conforming to the rule are collected
additionConfig JSON Add collector parameters
metaEnv List Collect the list of environment variables
metaLabel List Collect the customized Label list
metaContainer List Collect the fixed container metadata
metaToFields List Write the collected environment variables into the destination location as fields
HarvesterLimit Int Number of files collected in parallel by collector, defaulting to 1. When there are many files and a large log volume, it is recommended to use it with the max_procs parameter: https://cloud.baidu.com/doc/BLS/s/ym53rk1ua
  • destConfig
Parameter name Types Description
destType String Destination location type, supporting BLS
logStore String Logstore name
rateLimit Int Collection rate limit, unit: MB/second
clientCount Int Number of clients pushing the server, defaulting to 1. When the log volume is large, the increase of clients will improve data collection speed.
  • ProcessConfig
Parameter name Types Description
regex String If the processing type is regex, fill the regular expression
separator String If the processing type of separator, specify the separator: “blank”, “comma”, “tab”, “longstring”, “custom”
customSeparator String When “separator” is “custom”, fill the customized separator here.
quote String Specify quote characters for separator scenarios, options: blank, double quote ("), single quote ('), and custom
kvKeyIndex Int Used during KV-based processing, to specify the key group position (start from 1)
kvValueIndex Int Used during KV-based processing, to specify the value group position (start from 1)
sampleLog Int Log processing example, used to configure keys and dataType in console after processing
keys String Column name of processing results
dataType String Data type corresponding to each column of processing results, supporting string/int/float/bool
discardOnFailure Bool Whether to discard if log processing fails: true: discard; false: return the original value (for BES delivery, log contents shall be processed with the results delivered in JSON format)
keepOriginal Bool Whether to retain the original log: true: retain the original log in the @message field of kafka and the @raw field of BLS LogStore; false: not retain the original log upon processing success

Response

  • Response headers

No additional headers are required beyond the standard response headers.

  • Response parameters

None

Error code

No other error codes apart from standard error codes.

Example

  • Request example
Text
1POST /task HTTP/1.1
2Host: bls-log.bj.baidubce.com
3Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
4Content-Type: application/json; charset=utf-8
5
6{
7    "name": "chen_test_bos",
8    "config":{
9        "srcConfig":{
10            "srcType":"host",     
11            "srcDir":"/var/log",
12            "matchedPattern":"^.*$",
13            "ignorePattern":"",
14            "ttl":1,
15            "useMultiline": false,
16			"multilineRegex": "\[INFO|ERROR|DEBUG\]",
17			"recursiveDir": false,
18            "processType":"regex",
19            "processConfig": {
20                "regex":"",
21                "separator":"|",
22                "quote":""",
23				"sampleLog": "",
24                "keys":"host,time,log_level,log_content",
25                "dataType":"string,string,string,string",string/int/float/bool
26                "discardOnFailure" : true,
27                "keepOriginal": false
28                 "dataType": "string,string,string,string,string,int,string,string,string,string",
29                 "kvKeyIndex": 1,
30                 "kvValueIndex": 2
31            },
32            "logTime":"system",
33            "timestampKey":"time",
34            "dateFormat":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'Z",
35            "filterExpr":"$log_level=\"ERROR|WARN\""
36        },
37        "destConfig":{
38			"destType": "BLS",
39			"logStore": "test1021_3",
40			"rateLimit": 1
41        }
42    },
43    "hosts":[{"hostId":"w4q0q2xwfq5sdi3itcy4k31td43d7e76cd89"}],
44    "tags":[{"tagValue":"tag_value", "tagKey":"tag_key"}]
45}
  • Response example
Text
1HTTP/1.1 201
2Content-Type: application/json; charset=utf-8
3X-Bce-Request-Id: 2eeba101-4cc7-4cfe-b5ac-a3be8d060e33
4Date: Fri, 10 Apr 2020 04:42:37 GMT

Previous
LogAlarm Related Interfaces
Next
UpdateTask