UpdateLogStoreTemplate
Updated at:2025-11-03
Description
Update logstore template
Request
- Request syntax
Text
1POST /v3/bls?action=UpdateLogStoreTemplate HTTP/1.1
2Host: <Endpoint>
3Authorization: <Authorization String>
4Content-Type: application/json; charset=utf-8
5{
6 "name": <name>,
7 "priority": <priority>
8}
- 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
Text
1POST /v3/bls?action=UpdateLogStoreTemplate 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 // Template name: Unique under the same user, required
7 "name": "my-template",
8 // Log group matching pattern: Supports * wildcard, required
9 "projectPatterns": [
10 "my-project-*"
11 ],
12 // Logstore matching pattern: Supports * wildcard, required
13 "logstorePatterns": [
14 "my-logstore-*"
15 ],
16 // Logstore template priority: Higher values indicate higher priority, required
17 "priority": 10,
18 // Template configuration: Optional
19 "template": {
20 // Retention period (unit: days): Optional
21 "retention": 30,
22 // Initial number of shards: Optional
23 "shardCount": 1,
24 // 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
25 "disableShardAutoSplit": false,
26 // If automatic shard splitting is enabled, this field is required. Enter the maximum number of splits; value range: 1 to 50
27 "maxShardCount": 50,
28
29 // Whether to enable automatic hot-cold tiering: Optional; default value: false
30 "enableHotRetention": false,
31 // If hot-cold tiering is enabled, this field is required. Enter the hot storage retention period (unit: days); 7 <= hotRetention <= retention
32 "hotRetention": 7,
33
34 // Index configuration: Optional
35 "index": {
36 // Whether to enable full-text index: Optional; default value: false
37 "fulltext": true,
38 // Case sensitivity for full-text index: Optional; default value: false
39 "caseSensitive": false,
40 // Custom separator for full-text index: Optional. If not specified, the default separator is used: "@&?|#()='\",;:<>[]{}/ \n\t\r\\"
41 "separators": "@&?|#()='\",;:<>[]{}/ \n\t\r\\",
42 // Whether full-text index includes Chinese: Optional; default value: false
43 "includeChinese": false,
44
45 // Field index list: Optional
46 "fields": {
47 // Key: Name of the indexed field
48 "level": {
49 // Field type: Required. Optional values: bool, long, text, float, json
50 "type": "string",
51 // Case sensitivity: Optional; default value: false
52 "caseSensitive": false,
53 // Custom separator: Optional. If not specified, the default separator is used: "@&?|#()='\",;:<>[]{}/ \n\t\r\\"
54 "separators": "@&?|#()='\",;:<>[]{}/ \n\t\r\\",
55 // Whether to include Chinese: Optional; default value: false
56 "includeChinese": false,
57 // Whether to enable dynamic indexing: Optional; default value: false. Dynamic indexing can only be enabled when type=json
58 "dynamicMapping": false
59 },
60 "salary": {
61 "type": "float",
62 "caseSensitive": false,
63 "separators": "@&?|#()='\",;:<>[]{}/ \n\t\r\\",
64 "includeChinese": false,
65 "dynamicMapping": false
66 }
67 }
68 }
69 }
70}
- 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
5{
6 "success": true,
7 "code": "OK", // Error code
8 "message": "", // Error details
9}
