跳转至

获取日志索引列表



GET /api/v1/log_index_cfg/list

概述

列出工作空间的日志索引配置,可按索引类型和名称过滤。

调用前和使用步骤

查询当前工作空间的日志索引,也可查询已向当前空间授权的日志索引。只读调用,不创建或修改索引。

  1. 从目标工作空间的 API Key 管理取得 Key。查询当前空间时省略 targetWorkspaceUUID;跨空间时由授权方提供空间 UUID,不能仅凭 UUID 越过授权。传 * 不会自动加入当前空间;需要当前空间时省略该参数或显式传当前UUID。
  2. 先选择返回形状:不传分页参数,记录位于 content[];同时传 pageIndex 和 pageSize,记录位于 content.data[],分页信息位于顶层 pageInfo。只传其中一个不会启用分页。
  3. 按需要组合 search、queryType、isBindCustomStore、isDirectIndex;布尔值使用 true / false,多个查询类型使用英文逗号连接。
  4. 用返回的 uuid 调用获取索引详情。default 是默认索引的标识;普通记录使用自身 UUID。

普通记录按名称升序。当前空间的默认索引通常放在末尾,显式指定目标空间时通常放在开头。同名跨空间记录可能合并,因此这里不是跨空间索引配置总量统计。空结果时停止翻页,不代表该空间未配置任何索引;还需检查筛选条件及授权范围。

显式使用queryType时还会按Key的数据访问规则筛选。能列出索引配置不表示具有全部数据查询权限;实际查询仍由查询接口校验。

请求头

参数名 类型 必选 说明
DF-API-KEY string Y 工作空间调用凭据。记录 UUID 与调用凭据是不同字段。
例子: <DF-API-KEY>
获取或填写方式: 从当前工作空间 API Key 管理取得完整凭据。

Query 请求参数

参数名 类型 必选 说明
targetWorkspaceUUID string 省略查询当前空间;具体UUID查询该空间已向当前空间授权的日志索引;*仅查询当前站点的有效授权空间,不自动包含当前空间。返回受授权索引限制;显式使用queryType时还按当前Key数据访问规则筛选。
例子: wksp_example
获取或填写方式: 查询当前空间可省略;跨空间 UUID 由授权方从其空间信息提供,先完成日志数据授权。
isBindCustomStore boolean 是否只查询绑定自定义存储的索引:true 为绑定,false 为普通托管索引;省略不过滤。
例子: false
获取或填写方式: 用 true 列出绑定自定义存储的索引,用 false 列出普通索引。
queryType commaArray logging为内置日志及多数非SLS日志查询类型;standard为SLS时序类查询;query为SLS日志类查询。以目标记录实际queryType为准,多个值用英文逗号连接。筛选值包含logging时才可能返回默认索引。
例子: logging,standard
获取或填写方式: 可先不传此参数,读取返回记录的 queryType,再按需要筛选;多值如 logging,standard。
isDirectIndex boolean 是否只查询原生直写索引:true 为直写,false 为非直写;省略不过滤。
例子: false
获取或填写方式: 根据希望是否查询原生直写索引填写 true 或 false。
search string 不区分大小写的名称包含匹配。
允许空字符串: True
例子: access
获取或填写方式: 填日志索引名称或其中一部分。
orderBy string 排序字段仅支持 name,默认按名称升序。
可选值: ['name']
例子: name
获取或填写方式: 省略或传 name。
pageIndex integer 页码,从1开始;必须与 pageSize 同时传入才分页。
$minValue: 1
例子: 1
获取或填写方式: 启用分页时同时传 pageSize,从 1 开始。
pageSize integer 每页1至100条;必须与 pageIndex 同时传入才分页。
$minValue: 1
$maxValue: 100
例子: 20
获取或填写方式: 启用分页时同时传 pageIndex。

参数补充说明

示例中的资源标识为占位值,请替换为目标工作空间的实际值。

请求例子

不分页:记录在content数组。

curl --get 'https://openapi.guance.com/api/v1/log_index_cfg/list' \
  -H 'DF-API-KEY: <DF-API-KEY>'

分页并筛选:记录在content.data,分页位于顶层pageInfo。

curl --get 'https://openapi.guance.com/api/v1/log_index_cfg/list' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  --data-urlencode 'queryType=logging,standard' \
  --data-urlencode 'pageIndex=1' \
  --data-urlencode 'pageSize=20'

响应

HTTP 200,application/json。请先按是否传齐分页参数选择记录路径,不要固定假设 content 总是数组或对象。默认索引是合成记录,字段可能少于普通索引;以下标注“普通记录”的字段可省略。

字段 类型 说明
content object 或 array<object> 无分页时为索引数组;分页时为含 data 的对象。
content.data array<object> 分页时的索引记录。
content[].uuid 或 content.data[].uuid string 索引配置标识。普通行用于获取索引详情,默认索引使用 default。
content[].name 或 content.data[].name string 日志索引名称。
content[].workspaceUUID 或 content.data[].workspaceUUID string 索引所属工作空间。
content[].duration 或 content.data[].duration string 日志保留时长,例如 14d;绑定外部存储的索引可为空。
content[].isBindCustomStore 或 content.data[].isBindCustomStore integer 或 boolean 绑定外部存储为 1,普通托管索引为 0;默认行可返回 false。
content[].queryType 或 content.data[].queryType string 索引可支持的查询类型。
content[].directIndex 或 content.data[].directIndex integer 普通索引的原生直写标记,1 表示是,0 表示否。默认索引可省略。
content[].sortNo 或 content.data[].sortNo string 或 integer 索引配置中用于排序的值;默认索引可为 -1。
content[].storeType 或 content.data[].storeType string 索引关联的存储类型,默认索引可省略。
content.declaration object 或 null 分页时的工作空间声明;非分页时可出现在单条记录上。
content.cloneTotal integer 部分当前空间分页结果附带的克隆索引记录数,可能不按本次筛选条件过滤。
content.physicalTotal integer 部分当前空间分页结果附带的未删除索引配置记录数,包含克隆配置;不等同于本页数量,默认合成记录不计入。
content[].id 或 content.data[].id integer 普通记录的数值标识;后续接口使用 uuid。
content[].sourceIndexUUID 或 content.data[].sourceIndexUUID string 克隆来源索引的 UUID,空字符串表示普通来源索引。
content[].desc 或 content.data[].desc string 索引说明。
content[].conditions 或 content.data[].conditions string 该索引的过滤条件;默认索引通常为空字符串。
content[].status 或 content.data[].status integer 记录状态:0正常、2禁用;本接口不返回已删除记录。
content[].isFullLineIndex 或 content.data[].isFullLineIndex integer 是否启用全行索引,1启用、0未启用。
content[].exterStoreProject 或 content.data[].exterStoreProject string 绑定外部存储时的项目或上级容器名称;普通索引可为空。
content[].exterStoreName 或 content.data[].exterStoreName string 映射的外部存储名称;普通索引可为空。
content[].externalResourceAccessCfgUUID 或 content.data[].externalResourceAccessCfgUUID string 关联的外部资源访问配置 UUID,不是访问密钥。
content[].region 或 content.data[].region string 外部存储所在地域;普通索引可为空。
content[].isPublicNetworkAccess 或 content.data[].isPublicNetworkAccess integer 外部存储访问是否使用公网,1是、0否。
content[].setting 或 content.data[].setting object 或 null 索引设置,结构随存储类型变化;需要修改时先读取索引详情并使用对应创建或修改接口。
content[].extend 或 content.data[].extend object 或 null 索引扩展配置,字段由对应索引功能定义,未配置时可为空对象。
content[].storagePolicy 或 content.data[].storagePolicy object 或 null 索引的存储策略;默认索引沿用空间日志策略。
content[].workspaceName 或 content.data[].workspaceName string 或 null 索引所属工作空间的显示名称。
content[].workspaceStatus 或 content.data[].workspaceStatus integer 所属工作空间的状态;字段存在时用于识别空间状态,不代替授权判断。
content[].regionCode 或 content.data[].regionCode string 索引所属站点/地域标识,不是外部存储的 region 字段。
content[].regionName 或 content.data[].regionName string 或 null 站点/地域的显示名称。
content[].creator 或 content.data[].creator string 普通记录的创建主体标识,可能为账号或 API Key。
content[].updator 或 content.data[].updator string 普通记录的最近更新主体标识。
content[].createAt 或 content.data[].createAt integer 普通记录创建时间,Unix秒。
content[].updateAt 或 content.data[].updateAt integer 普通记录最近更新时间,Unix秒。
content[].deleteAt 或 content.data[].deleteAt integer 普通记录删除时间,未删除通常为-1。
content[].creatorInfo 或 content.data[].creatorInfo object 普通记录的创建主体摘要;无法取得时为空对象。
content[].updatorInfo 或 content.data[].updatorInfo object 普通记录的更新主体摘要;无法取得时为空对象。
content[].creatorInfo.uuid 或 content.data[].creatorInfo.uuid string 主体UUID。仅普通记录在主体信息存在时返回。
content[].creatorInfo.status 或 content.data[].creatorInfo.status integer 主体账号或Key的状态。仅普通记录在主体信息存在时返回。
content[].creatorInfo.wsAccountStatus 或 content.data[].creatorInfo.wsAccountStatus integer 主体在当前空间的关联状态;不存在关联时可为3。仅普通记录在主体信息存在时返回。
content[].creatorInfo.username 或 content.data[].creatorInfo.username string 或 null 登录名或Key名称,系统主体可为空。仅普通记录在主体信息存在时返回。
content[].creatorInfo.name 或 content.data[].creatorInfo.name string 或 null 主体显示名称。仅普通记录在主体信息存在时返回。
content[].creatorInfo.iconUrl 或 content.data[].creatorInfo.iconUrl string 头像地址,未配置为空字符串;系统主体可省略。仅普通记录在主体信息存在时返回。
content[].creatorInfo.email 或 content.data[].creatorInfo.email string 或 null 账号通常为邮箱;Key可为Key UUID,系统主体可为系统名称,不保证是可投递邮箱。仅普通记录在主体信息存在时返回。
content[].creatorInfo.mobile 或 content.data[].creatorInfo.mobile string 或 null 主体手机号,未配置可为空。仅普通记录在主体信息存在时返回。
content[].creatorInfo.countryCode 或 content.data[].creatorInfo.countryCode string 手机号国家/地区代码,未配置为空;系统主体可省略。仅普通记录在主体信息存在时返回。
content[].creatorInfo.acntWsNickname 或 content.data[].creatorInfo.acntWsNickname string 当前空间昵称,未配置为空;系统主体可省略。仅普通记录在主体信息存在时返回。
content[].updatorInfo.uuid 或 content.data[].updatorInfo.uuid string 主体UUID。仅普通记录在主体信息存在时返回。
content[].updatorInfo.status 或 content.data[].updatorInfo.status integer 主体账号或Key的状态。仅普通记录在主体信息存在时返回。
content[].updatorInfo.wsAccountStatus 或 content.data[].updatorInfo.wsAccountStatus integer 主体在当前空间的关联状态;不存在关联时可为3。仅普通记录在主体信息存在时返回。
content[].updatorInfo.username 或 content.data[].updatorInfo.username string 或 null 登录名或Key名称,系统主体可为空。仅普通记录在主体信息存在时返回。
content[].updatorInfo.name 或 content.data[].updatorInfo.name string 或 null 主体显示名称。仅普通记录在主体信息存在时返回。
content[].updatorInfo.iconUrl 或 content.data[].updatorInfo.iconUrl string 头像地址,未配置为空字符串;系统主体可省略。仅普通记录在主体信息存在时返回。
content[].updatorInfo.email 或 content.data[].updatorInfo.email string 或 null 账号通常为邮箱;Key可为Key UUID,系统主体可为系统名称,不保证是可投递邮箱。仅普通记录在主体信息存在时返回。
content[].updatorInfo.mobile 或 content.data[].updatorInfo.mobile string 或 null 主体手机号,未配置可为空。仅普通记录在主体信息存在时返回。
content[].updatorInfo.countryCode 或 content.data[].updatorInfo.countryCode string 手机号国家/地区代码,未配置为空;系统主体可省略。仅普通记录在主体信息存在时返回。
content[].updatorInfo.acntWsNickname 或 content.data[].updatorInfo.acntWsNickname string 当前空间昵称,未配置为空;系统主体可省略。仅普通记录在主体信息存在时返回。
pageInfo object 分页结果的外层分页对象。
pageInfo.pageIndex integer 当前页码。
pageInfo.pageSize integer 每页条数。
pageInfo.count integer 本页条数。
pageInfo.totalCount integer 可见并满足条件的总条数。
{
  "code": 200,
  "content": {
    "data": [
      {
        "uuid": "default",
        "name": "default",
        "workspaceUUID": "wksp_example",
        "workspaceName": "示例工作空间",
        "workspaceStatus": 0,
        "status": 0,
        "conditions": "",
        "duration": "14d",
        "isBindCustomStore": false,
        "isFullLineIndex": 0,
        "queryType": "logging",
        "storagePolicy": {},
        "sortNo": -1,
        "extend": {},
        "regionCode": "example-region",
        "regionName": "示例地域"
      }
    ],
    "declaration": null,
    "cloneTotal": 0,
    "physicalTotal": 0
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE",
  "pageInfo": {
    "pageIndex": 1,
    "pageSize": 20,
    "count": 1,
    "totalCount": 1
  }
}

不分页请求的响应示例(当前空间仅默认索引):

{
  "code": 200,
  "content": [
    {
      "uuid": "default",
      "name": "default",
      "workspaceUUID": "wksp_example",
      "workspaceName": "示例工作空间",
      "workspaceStatus": 0,
      "status": 0,
      "conditions": "",
      "duration": "14d",
      "isBindCustomStore": false,
      "isFullLineIndex": 0,
      "queryType": "logging",
      "storagePolicy": {},
      "sortNo": -1,
      "extend": {},
      "regionCode": "example-region",
      "regionName": "示例地域",
      "declaration": null
    }
  ],
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

错误响应

鉴权、限流和公共请求错误参见公共错误定义。

HTTP 状态 errorCode 触发条件 消息或响应说明 处理方式
406 ft.ParameterValidationFailed 页码/页大小不在允许范围、orderBy 不是 name,或传入未声明的 Query 参数 请求字段校验失败。 核对 message 指出的字段;分页同时使用 pageIndex≥1、pageSize为1至100;不要把其他接口的 cursor、targetRegion 参数直接加入本接口。

文档评价

文档内容是否对您有帮助?