Domain name for API request: cls.intl.tencentcloudapi.com.
This API is used to create collection rule configuration.
A maximum of 30 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: CreateConfig. |
| Version | Yes | String | Common Params. The value used for this API: 2020-10-16. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| Name | Yes | String | collection configuration name -Names do not contain special characters - Name can be up to 255 characters, exceeding which will be truncated |
| Output | Yes | String | Log topic ID to which the collection configuration belongs, i.e., topic ID -Obtain the log topic Id through Get Log Topic List. |
| Path | No | String | Log collection path, which contains the file name. Multiple paths are supported and should be separated by English commas. It is required for file collection. |
| LogType | No | String | The collected log type, default is minimalist_log. Supports the following types:- json_log: JSON File Log (For more information, see Using JSON pattern to collect logs);- delimiter_log: Delimiter - File Logs (For more information, see Using delimiter pattern to collect logs);- minimalist_log: Single-line Full-text File Log (For more information, see Using single-line full-text pattern to collect logs);- fullregex_log: Single line full regular expression - File log (For more information, see Using single-line - complete regular expression pattern to collect logs);- multiline_log: Multiline Full-text File Log (For more information, see Using multi-line full-text pattern to collect logs);- multiline_fullregex_log: Multi-line complete regular expression - File Logs (For more information, see Using multi-line - complete regular expression pattern to collect logs);- user_define_log: Combined parsing (Suitable for logs with multiple nested formats, see Using combined parsing pattern to collect logs);- service_syslog: syslog collection (For more information, see Collect Syslog);- windows_event_log: Windows event log (see Collecting Windows Event Logs). |
| ExtractRule | No | ExtractRuleInfo | Extraction rule. If ExtractRule is set, LogType must be set. |
| ExcludePaths.N | No | Array of ExcludePathInfo | Collection path blocklist |
| UserDefineRule | No | String | Custom collection rules, serialized JSON string. Required when LogType is user_define_log. |
| AdvancedConfig | No | String | Advanced collection configuration. A JSON string, Key/Value definition as follows:- ClsAgentFileTimeout (timeout property), value range: an integer greater than or equal to 0, where 0 means no timeout.- ClsAgentMaxDepth (maximum directory depth), value range: an integer greater than or equal to 0.- ClsAgentParseFailMerge (Merge Parsing Failure Log), value range: true or falseSample: {\"ClsAgentFileTimeout\":0,\"ClsAgentMaxDepth\":10,\"ClsAgentParseFailMerge\":true}Default placeholder value in console: {\"ClsAgentDefault\":0} |
| InputType | No | String | Log input type (Note: Required for Windows scenario and only supports file and windows_event type) -file type collection -windows event collection -syslog: System log collection |
| Parameter Name | Type | Description |
|---|---|---|
| ConfigId | String | Collection configuration ID |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
FilterKeyRegex: Loglistener log filter rule list (legacy version), keys to be filtered, and corresponding regex.
Note: For LogListener 2.9.3 and above versions, use AdvanceFilterRules to configure log filtering rules.
POST / HTTP/1.1
Host: cls.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateConfig
<Common request parameters>
{
"Name": "test2.8.8",
"Path": "/data/log/**/my.log",
"ExcludePaths": [],
"LogType": "minimalist_log",
"UserDefineRule": "",
"ExtractRule": {
"IsGBK": 0,
"FilterKeyRegex": [
{
"Key": "__CONTENT__",
"Regex": "400|500"
}
],
"Backtracking": 0,
"MetadataType": 0,
"MetaTags": [
{
"Key": "",
"Value": ""
}
],
"PathRegex": "",
"AdvanceFilterRules": []
},
"AdvancedConfig": "{\"ClsAgentFileTimeout\":0}",
"Output": "6bf3355c-3c88-4566-89c8-76c3ca37bae9"
}
{
"Response": {
"ConfigId": "a2c6342c-270a-4468-86cf-92625e468888",
"RequestId": "a21b16c1-4da9-45a1-a612-59e5757384f3"
}
}
This example shows you how to create combined parsing configuration.
POST / HTTP/1.1
Host: cls.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateConfig
<Common request parameters>
{
"Name": "my-test",
"Path": "/data/log/**/my.log",
"ExcludePaths": [],
"LogType": "user_define_log",
"UserDefineRule": "{\"processors\":[{\"type\":\"processor_split_delimiter\",\"detail\":{\"Delimiter\":\",\",\"ExtractKeys\":[\"time\",\"msg1\",\"msg2\"]},\"processors\":[{\"type\":\"processor_timeformat\",\"detail\":{\"KeepSource\":true,\"TimeFormat\":\"%s\",\"SourceKey\":\"time\"}},{\"type\":\"processor_split_delimiter\",\"detail\":{\"KeepSource\":false,\"Delimiter\":\"|\",\"SourceKey\":\"msg1\",\"ExtractKeys\":[\"submsg1\",\"submsg2\",\"submsg3\"]},\"processors\":[]},{\"type\":\"processor_split_key_value\",\"detail\":{\"KeepSource\":false,\"Delimiter\":\":\",\"SourceKey\":\"msg2\"}}]}]}",
"ExtractRule": {
"IsGBK": 0,
"FilterKeyRegex": [],
"UnMatchUpLoadSwitch": true,
"UnMatchLogKey": "LogParseFailure",
"Backtracking": 0,
"MetadataType": 2,
"MetaTags": [
{
"Key": "mryx",
"Value": "item"
}
],
"PathRegex": "",
"AdvanceFilterRules": []
},
"AdvancedConfig": "{\"ClsAgentFileTimeout\":3600}",
"Output": "6bf3355c-3c88-4566-89c8-76c3ca37bae9"
}
{
"Response": {
"ConfigId": "d72dae22-084c-4d20-a81b-f42e25c88888",
"RequestId": "c708e9af-231e-4a94-a888-3ab24e5fbd97"
}
}
This example shows you how to create collection rule configuration.
POST / HTTP/1.1
Host: cls.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateConfig
<Common request parameters>
{
"Name": "my-test-minimalist_log",
"Path": "/data/log/**/my.log",
"ExcludePaths": [
{
"Type": "File",
"Value": "/data/log/mryx/my.log"
}
],
"LogType": "minimalist_log",
"UserDefineRule": "",
"ExtractRule": {
"IsGBK": 0,
"FilterKeyRegex": [],
"Backtracking": 0,
"MetadataType": 2,
"MetaTags": [
{
"Key": "mryx",
"Value": "item"
},
{
"Key": "wd",
"Value": "shop"
}
],
"PathRegex": "",
"AdvanceFilterRules": [
{
"Key": "__CONTENT__",
"Rule": 0,
"Value": "400|500"
}
]
},
"AdvancedConfig": "{\"ClsAgentMaxDepth\":10}",
"Output": "6bf3355c-3c88-4566-89c8-76c3ca37bae9"
}
{
"Response": {
"ConfigId": "b5a78efe-984c-47e2-99a8-52dbd1388888",
"RequestId": "037a6def-51d4-449b-a894-7cd2410bfae1"
}
}
This example shows you how to create collection rule configuration.
POST / HTTP/1.1
Host: cls.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateConfig
<Common request parameters>
{
"Name": "Single-line full regex - file log"
"Path": "/data/log/**/my.log",
"ExcludePaths": [
{
"Type": "File",
"Value": "/data/log/my.log"
}
],
"LogType": "fullregex_log",
"UserDefineRule": "",
"ExtractRule": {
"IsGBK": 0,
"BeginRegex": "(\\w)(\\w+\\s\\S+)\\s+(\\d+)\\s([^:]+):(\\d+)\\]\\s(.*)",
"LogRegex": "(\\w)(\\w+\\s\\S+)\\s+(\\d+)\\s([^:]+):(\\d+)\\]\\s(.*)",
"Keys": [
"level",
"time",
"thread_id",
"file",
"lineno",
"msg"
],
"TimeKey": "time",
"TimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"FilterKeyRegex": [
{
"Key": "key1",
"Regex": "value1"
},
{
"Key": "key2",
"Regex": "velue2"
}
],
"UnMatchUpLoadSwitch": true,
"UnMatchLogKey": "LogParseFailure",
"Backtracking": 10,
"MetadataType": 2,
"MetaTags": [
{
"Key": "mryx",
"Value": "item"
}
],
"PathRegex": "",
"AdvanceFilterRules": []
},
"AdvancedConfig": "{\"ClsAgentMaxDepth\":10,\"ClsAgentFileTimeout\":3600}",
"Output": "6bf3355c-3c88-4566-89c8-76c3ca37bae9"
}
{
"Response": {
"ConfigId": "8e63fe9a-5f36-49b0-bdbf-ab1c29e58888",
"RequestId": "420f4f07-2134-4167-9442-9ac6c6ffe3d8"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| AuthFailure | CAM signature/authentication error. |
| FailedOperation | Operation failed. |
| InternalError | Internal error. |
| InvalidParameter | Incorrect parameter. |
| InvalidParameter.ConfigConflict | The same collection configuration rule already exists. |
| InvalidParameterValue | Incorrect parameter value. |
| LimitExceeded.Config | The collection rule configuration exceeds the maximum value limit. |
| MissingParameter | Missing parameter. |
| OperationDenied | Operation denied. |
| OperationDenied.AccountDestroy | The account has been terminated. |
| OperationDenied.AccountIsolate | The account has overdue payments. |
| OperationDenied.AccountNotExists | The account does not exist. |
| ResourceNotFound.ConfigNotExist | The specified collection rule configuration does not exist. |
| ResourceNotFound.TopicNotExist | The log topic does not exist. |
文档反馈