Skip to content

Export



POST /api/v1/log_index_cfg/export

Overview

Export log index templates based on the log index list filter criteria.

Query Request Parameters

Parameter Type Required Description
search string Search by index name
Allow empty string: True
isBindCustomStore boolean Whether to bind custom storage; only internal indexes can be exported, passing true returns an empty result
isDirectIndex boolean Whether it is a native direct-write index
queryType commaArray Storage query type

Additional Parameter Notes

This API is used to export log index templates independently and does not require running a workspace resource export task.

Request Notes

  1. The export parameters are consistent with those of the log index list API, but pagination and cross-workspace parameters are not supported.
  2. The currently supported filter parameters are search, queryType, isDirectIndex, and isBindCustomStore.
  3. Only internal log indexes in the current workspace are exported.
  4. The default index and external indexes are not exported.
  5. The response is a JSON list that can be used directly as the input template for /log_index_cfg/import.

Exported Fields

Field Type Description
name string Index name
desc string Index description
directIndex boolean Whether it is a native direct-write index
isFullLineIndex int Whether it is a full-line index. 0 means the message field index is retained, 1 means full-line index; only workspaces whose log storage is scopedb can set it to 1
conditions string Index matching conditions
duration string Storage duration
storagePolicy json Long-term storage policy
extend json Extended configuration
setting json Storage settings
fields array Field mapping configuration
cloneConfig json/null Complete clone index configuration; null when there is no clone index
is_disable boolean Whether it is disabled

Request Example

curl 'https://openapi.truewatch.com/api/v1/log_index_cfg/export?search=app-log&isDirectIndex=false' \
-H 'DF-API-KEY: <DF-API-KEY>'

Response

{
    "code": 200,
    "content": [
        {
            "name": "app-log",
            "desc": "应用日志索引",
            "directIndex": false,
            "isFullLineIndex": 0,
            "conditions": "",
            "duration": "7d",
            "storagePolicy": {},
            "extend": {},
            "setting": {},
            "fields": [
                {
                    "field": "service",
                    "originalField": "service"
                }
            ],
            "cloneConfig": {
                "name": "app-log-clone",
                "desc": "应用日志克隆索引",
                "isFullLineIndex": 0,
                "conditions": "service = 'api'",
                "duration": "3d",
                "storagePolicy": {},
                "extend": {
                    "matchMode": "basic",
                    "filters": [
                        {
                            "name": "service",
                            "condition": "and",
                            "operation": "=",
                            "value": [
                                "api"
                            ]
                        }
                    ]
                },
                "setting": {},
                "fields": [
                    {
                        "field": "host_alias",
                        "originalField": "host"
                    }
                ],
                "is_disable": false
            },
            "is_disable": false
        }
    ],
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-EXAMPLE"
}