UpdateLogStoreTemplate
Last Updated:2025-11-14
Description
Update logstore template
Request
- Request syntax
POST /v3/bls?action=UpdateLogStoreTemplate HTTP/1.1
Host: <Endpoint>
Authorization: <Authorization String>
Content-Type: application/json; charset=utf-8
{
"name": <name>,
"priority": <priority>
}- 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 | Template name: Unique under the same user |
| projectPatterns | List<String> | Yes | RequestBody | Log group matching pattern: Supports * wildcard |
| logstorePatterns | List<String> | Yes | RequestBody | Logstore matching pattern: Supports * wildcard |
| priority | Int | Yes | RequestBody | Logstore template priority: Higher values indicate higher priority; unique under the same user |
| template | Template | No | RequestBody | Template configuration |
The element structure of Template object is as follows:
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| retention | Int | No | RequestBody | Logstore retention period: Unit is days |
| shardCount | Int | No | RequestBody | Initial number of shards for the logstore |
| disableShardAutoSplit | Boolean | No | RequestBody | Whether to disable automatic shard splitting: If automatic splitting is enabled, BLS will automatically expand shards based on the log write traffic of the logstore. Optional; default value: false |
| maxShardCount | Int | No | RequestBody | If automatic shard splitting is enabled, this field is required. Enter the maximum number of splits; value range: [1 to 50] |
| enableHotRetention | Boolean | No | RequestBody | Whether to enable automatic hot-cold tiering: Optional; default value: false |
| hotRetention | Int | No | RequestBody | If hot-cold tiering is enabled, this field is required. Enter the hot storage retention period (unit: days); 7 <= hotRetention <= retention |
| index | Object | No | RequestBody | Index configuration: Refer to Create Index API |
Response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Field | Types | Description |
|---|---|---|
| success | Boolean | Whether the request succeeded |
| code | String | Request code, OK for success, or a specific error code for failure |
| message | String | Empty for request success, or a specific error message for request failure |
Error code
Apart from standard error codes, the following codes may be returned:
| Error code | Error message | Description | HTTP status code |
|---|---|---|---|
| InvalidParameter | Request param invalid: [msg] | Invalid parameter exception | 400 |
Example
- Request example
POST /v3/bls?action=UpdateLogStoreTemplate HTTP/1.1
Host: bls-log.bj.baidubce.com
Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
Content-Type: application/json; charset=utf-8
{
// Template name: Unique under the same user, required
"name": "my-template",
// Log group matching pattern: Supports * wildcard, required
"projectPatterns": [
"my-project-*"
],
// Logstore matching pattern: Supports * wildcard, required
"logstorePatterns": [
"my-logstore-*"
],
// Logstore template priority: Higher values indicate higher priority, required
"priority": 10,
// Template configuration: Optional
"template": {
// Retention period (unit: days): Optional
"retention": 30,
// Initial number of shards: Optional
"shardCount": 1,
// Whether to disable automatic shard splitting: If automatic splitting is enabled, BLS will automatically expand shards based on the log write traffic of the logstore. Optional; default value: false
"disableShardAutoSplit": false,
// If automatic shard splitting is enabled, this field is required. Enter the maximum number of splits; value range: 1 to 50
"maxShardCount": 50,
// Whether to enable automatic hot-cold tiering: Optional; default value: false
"enableHotRetention": false,
// If hot-cold tiering is enabled, this field is required. Enter the hot storage retention period (unit: days); 7 <= hotRetention <= retention
"hotRetention": 7,
// Index configuration: Optional
"index": {
// Whether to enable full-text index: Optional; default value: false
"fulltext": true,
// Case sensitivity for full-text index: Optional; default value: false
"caseSensitive": false,
// Custom separator for full-text index: Optional. If not specified, the default separator is used: "@&?|#()='\",;:<>[]{}/ \n\t\r\\"
"separators": "@&?|#()='\",;:<>[]{}/ \n\t\r\\",
// Whether full-text index includes Chinese: Optional; default value: false
"includeChinese": false,
// Field index list: Optional
"fields": {
// Key: Name of the indexed field
"level": {
// Field type: Required. Optional values: bool, long, text, float, json
"type": "string",
// Case sensitivity: Optional; default value: false
"caseSensitive": false,
// Custom separator: Optional. If not specified, the default separator is used: "@&?|#()='\",;:<>[]{}/ \n\t\r\\"
"separators": "@&?|#()='\",;:<>[]{}/ \n\t\r\\",
// Whether to include Chinese: Optional; default value: false
"includeChinese": false,
// Whether to enable dynamic indexing: Optional; default value: false. Dynamic indexing can only be enabled when type=json
"dynamicMapping": false
},
"salary": {
"type": "float",
"caseSensitive": false,
"separators": "@&?|#()='\",;:<>[]{}/ \n\t\r\\",
"includeChinese": false,
"dynamicMapping": false
}
}
}
}
}- Response example
HTTP/1.1 201
Content-Type: application/json; charset=utf-8
X-Bce-Request-Id: 2eeba101-4cc7-4cfe-b5ac-a3be8d060e33
Date: Fri, 10 Apr 2020 04:42:37 GMT
{
"success": true,
"code": "OK", // Error code
"message": "", // Error details
}