Create Default Type Index¶
POST /api/v1/log_index_cfg/add
Overview¶
Create a default storage type index configuration.
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| name | string | Y | Index name Example: xxx Allow empty: False Max length: 256 |
| desc | string | Index description Example: xxx Allow empty: False Allow empty string: True Max length: 1024 |
|
| extend | json | Frontend custom data Allow empty: True |
|
| duration | string | Data retention duration Allow empty: False Example: 7d |
|
| storagePolicy | json | Long-term storage policy. Only workspaces with scopedb log storage can enable it. pay, enterprise, unlimited support long-term log storage. enterprise/unlimited logging max 1800d. enterprise/unlimited rp supports custom long-term storage duration (max 3600d). unlimited only supports metric_point_total billing type when BossAccountSet is enabled, otherwise treated as metric_point_total. Contains longStorageEnabled and longStorageDuration. Example: {'longStorageEnabled': True, 'longStorageDuration': '180d'} Allow empty: False |
|
| directIndex | boolean | Direct native index, default false. Added in iteration 2025-06-25. Allow empty: False |
|
| isFullLineIndex | int | Whether it is a full-line index. 0/false means retain message field index, 1/true means full-line index, default 0. Only workspaces with scopedb log storage can set to 1. Allow empty: False |
|
| setting | json | Configuration information. Allow empty: False |
|
| setting.hot_retention | int | Volcengine storage, standard storage - hot storage. Allow empty: False |
|
| setting.cold_retention | int | Volcengine storage, infrequent storage - cold data. Allow empty: False |
|
| setting.archive_retention | int | Volcengine storage, archive storage - archive data. Allow empty: False |
Parameter Supplementary Notes¶
1. Request Parameter Description
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| name | String | Required | Index name |
| desc | String | Index description | |
| extend | Json | Extension information for frontend display | |
| duration | Json | Total index storage duration, example: 60d | |
| directIndex | Boolean | Direct native index, default false. Added in iteration 2025-06-25. | |
| setting | Json | Index configuration information when log storage is Volcengine. |
2. Parameters in setting
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| hot_retention | int | Required | Standard storage - hot data, must be whole day hours. Unit: hours h |
| cold_retention | int | Infrequent storage - cold data, must be whole day hours. Unit: hours h | |
| archive_retention | int | Archive storage - archive data, must be whole day hours. Unit: hours h |
2.1 Volcengine storage duration limits:
Standard storage: hot data storage, range: 1-1800 days. If infrequent storage exists, range: 7-1800 days. If archive storage exists, range: 30-1800 days.
Infrequent storage: cold data storage, range: 30-1800 days.
Archive storage: archive data storage, range: 60-1800 days.
2.2 Volcengine storage duration limit:
Total storage duration (standard storage + infrequent storage + archive storage) cannot exceed 1800 days.
3. Parameters in extend
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| matchMode | String | Matching mode, optional values: basic, advanced. Default is basic. |
|
| filters | Array[dict] | Common matching filter conditions list. Direct native index does not need to configure. It is recommended to pass an empty array in advanced mode. |
|
| advancedFilter | Dict | Advanced matching condition tree, effective when matchMode=advanced. |
|
| extendFields | Array | Index extension field information. | |
| extendFields[*].tag | String | Yes | Key field name. |
| extendFields[*].alias | String | Key field alias. | |
| services | String | Matching services. |
4. Structure of extend.filters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| condition | string | Relation with the previous filter condition, optional values: and, or. Default: and. |
|
| name | string | Field name to filter. | |
| operation | string | Operator, optional values: in, not_in. |
|
| value | array | Value list. | |
| value[#] | string/int/boolean | Can be string, number, or boolean. |
5. Structure of extend.advancedFilter
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | Root node is fixed to group. |
| condition | string | Yes | Relationship between child nodes within the current group, optional values: and, or. |
| filters | array | Yes | List of child nodes, elements can be rule or group. |
| filters[#].type | string | Yes | Node type, optional values: rule, group. |
| filters[#].name | string | Required for rule | Log field name. |
| filters[#].operation | string | Required for rule | Operator, optional values: =, !=, in, not_in, match, not_match, wildcard, not_wildcard, regexp, not_regexp, >, <, >=, <=, exist, not_exist. |
| filters[#].value | array | Required for rule | Value list. Use empty array for exist / not_exist. |
When matchMode=advanced, the backend will generate conditions in DQL where style, e.g., IN, NOT IN, = match('xxx'), = wildcard('xxx'). The common filters still maintain the historical generation format.
Request Example¶
curl 'https://openapi.truewatch.com/api/v1/log_index_cfg/add' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--data-raw '{"name":"test_index","duration":"14d","isFullLineIndex":0,"extend":{"filters":[{"condition":"and","name":"host","operation":"in","value":["custom_host1"]}]}}' \
--compressed
Response¶
{
"code": 200,
"content": {
"conditions": "{ `host` in [ 'custom_host1' ] }",
"createAt": 1698751853,
"creator": "xxx",
"deleteAt": -1,
"duration": "14d",
"extend": {
"filters": [
{
"condition": "and",
"name": "host",
"operation": "in",
"value": [
"custom_host1"
]
}
]
},
"exterStoreName": "",
"exterStoreProject": "",
"externalResourceAccessCfgUUID": "",
"id": null,
"isBindCustomStore": 0,
"isFullLineIndex": 0,
"isPublicNetworkAccess": 0,
"name": "test_index",
"queryType": "logging",
"region": "",
"setting": {},
"sortNo": 3,
"status": 0,
"storeType": "",
"updateAt": 1698751853,
"updator": "xxx",
"uuid": "lgim_xxxx32",
"workspaceUUID": "wksp_xxxx32"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-600346C3-6C89-4391-9CA3-2152D10149D8"
}