获取¶
GET /api/v1/logging_query_rule/{logging_query_rule_uuid}/get
概述¶
读取指定访问规则的完整保存配置与来源/角色资料。
调用前和使用步骤¶
从日志访问规则列表取UUID。此入口只读取type=logging规则;同表非日志UUID也返回404。返回保存实体及来源、角色摘要,不返回列表的creatorInfo/updatorInfo、memberCount或relMemberInfos。来源资料可能历史/缺失,grantStatus=3提示授权不可用;不要把保存配置视为当前有效权限证明。
规则保存影响后续符合条件身份的数据查询范围/结果脱敏,不修改、删除或补采原始数据,也不新增角色的基础查询权限。多个角色及规则按查询侧策略合并,不能仅凭单条规则推断最终权限;Owner豁免,管理员和空间的“数据访问范围限制”设置会改变无匹配角色的处理,应使用代表成员实际查询验收。本次只读规则,不修改配置或清理规则缓存。
路由参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| logging_query_rule_uuid | string | Y | 路径规则UUID,不能用名称或角色UUID;读取/修改仅当前空间非删除项。 例子: lqrl_example获取或填写方式: 从日志访问规则列表的content.data[].uuid获取。 |
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间的 OpenAPI 鉴权凭据。 例子: <DF-API-KEY>获取或填写方式: 从目标工作空间的 API Key 管理获取有该操作权限的 OpenAPI Key。 |
请求例子¶
curl --get 'https://openapi.guance.com/api/v1/logging_query_rule/lqrl_example/get' \
-H 'DF-API-KEY: <DF-API-KEY>'
响应¶
HTTP 200,application/json。下方示例展示可直接读取的主要字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| content.id | integer | 已存在日志数据访问规则的数据库编号,调用使用uuid。 |
| content.uuid | string | lqrl_规则UUID,两个模块共用实体与标识。 |
| content.workspaceUUID | string | 本规则所属工作空间,区别来源空间。 |
| content.status | integer | 0启用、2禁用、3删除;本模块读取仅非删除。 |
| content.creator | string | 创建身份。 |
| content.updator | string | 最近更新身份,初始可为空。 |
| content.createAt | integer | 创建Unix秒。 |
| content.updateAt | integer | 更新Unix秒,未更新-1。 |
| content.deleteAt | integer | 删除Unix秒,未删除-1。 |
| content.name | string | 保存值:可省略;缺省/空字符串时按调用身份展示名及当前Unix秒尝试生成,修改同样重新生成,不保持旧名称。 最大64计数单位(ASCII/半角片假名1、其他字符2);启用和禁用的同类型规则都参与重名检查。 |
| content.desc | string | 保存值:可选,最多256同上计数单位,缺省/空串清为空;修改不是保持原值。 |
| content.indexes | array | 当前保存的日志索引标识数组,["*"]表示全部可用日志索引;仍受实际来源授权约束。 |
| content.indexes[] | string | 保存值:数组成员建议非空字符串;原声明未逐项强制,错误类型可导致500。 |
| content.roleUUIDs | array | 当前保存的适用角色UUID数组,["*"]为全部角色,[]不匹配任何角色;基础权限仍须独立具备。 |
| content.roleUUIDs[] | string | 保存值:应使用有效角色;不要使用账号UUID。 |
| content.conditions | string | 当前保存的日志过滤表达式,本读取不重新执行事件E查询校验。 |
| content.extend | json | 保存值:可选任意JSON回显,缺省{};无统一必填子键或单位,服务端不从中自动生成conditions,修改整体替换;不要存凭据。 |
| content.extend.自定义键 | any | 保存值:任意可序列化JSON值;不是额外生效条件。 |
| content.logic | string | 保存值:兼容回显字段,通常and/or;新增声明必填,修改可省略。 省略保存空串;真实生效过滤直接使用conditions,改logic不会重写条件,多角色/多规则合并不由该字段控制。 |
| content.maskFields | string | 保存值:可选,缺省空串不配置此规则的字段脱敏;修改省略清空。选中字段且reExprs=[]时非null值整字段遮蔽为***;给非空正则列表时只应用启用正则,全部禁用不等于整字段遮蔽。建议≤256字符以适配存储列。 |
| content.reExprs | array | 保存值:可选,缺省[],修改整体替换。保存时每项正则均校验,包括enable=false项;错误正则返回ft.ErrorRegularExpression。不要用单独*表示任意字符串,使用.*。选中字段无正则时整字段***;正则只处理字符串内容的匹配片段,将匹配内容替换成***;保存校验与执行引擎有差异,成功保存后仍需用代表查询验证。 |
| content.reExprs[] | json | 保存值:建议只使用name/enable/reExpr,数组元素原声明未强制结构,非对象可500。 |
| content.reExprs[].name | string | 保存值:可选回显名,不作为匹配表达式,省略不影响正则匹配。 |
| content.reExprs[].enable | boolean | 保存值:建议显式布尔,缺省按未启用处理;禁用正则仍必须语法合法。 |
| content.reExprs[].reExpr | string | 保存值:建议非空正则。当前缺省会按空串检查,不能依赖服务端补全有效表达式。 |
| content.sources | array | 兼容实体字段;日志专用新建保存为空数组,修改不赋值而保持已有内容,本接口不接受sources输入。 |
| content.sources[] | string | 保存值:按上级type解释的单个来源,建议非空字符串。 |
| content.type | string | 固定为logging;本日志专用接口不接受type输入。 |
| content.regionCode | string | 当前保存的日志来源站点代码,历史空字符串按当前站点处理;不代表新建了来源授权。 |
| content.indexWsInfo | string 或 object | 仅日志规则:*为全部;否则以原indexes成员为动态键;资源不存在/取不到资料时子对象可{}。 |
| content.indexWsInfo.索引标识 | object | 一个配置索引的空间和索引资料。 |
| content.indexWsInfo.索引标识.wsInfo | object | 来源空间资料,可为空对象。 |
| content.indexWsInfo.索引标识.wsInfo.uuid | string | 来源空间UUID。 |
| content.indexWsInfo.索引标识.wsInfo.name | string | 来源空间名称。 |
| content.indexWsInfo.索引标识.wsInfo.status | integer | 空间状态。 |
| content.indexWsInfo.索引标识.wsInfo.regionCode | string | 站点代码。 |
| content.indexWsInfo.索引标识.wsInfo.regionName | string 或 null | 站点本地化名称。 |
| content.indexWsInfo.索引标识.wsInfo.datastore | object | 可选,各数据类型对应存储类别映射。 |
| content.indexWsInfo.索引标识.wsInfo.datastore.数据类型 | string | 例如logging对应scopedb;不是可写配置。 |
| content.indexWsInfo.索引标识.wsInfo.durationSet | object | 可选,各数据类型保留时长。 |
| content.indexWsInfo.索引标识.wsInfo.durationSet.数据类型 | string | 整数+d等时长字符串;按数据域区分。 |
| content.indexWsInfo.索引标识.wsInfo.storagePolicy | object | 日志来源空间可选长期策略映射。 |
| content.indexWsInfo.索引标识.wsInfo.storagePolicy.数据类型 | object | 对应数据域长期策略。 |
| content.indexWsInfo.索引标识.wsInfo.storagePolicy.数据类型.isEnable | boolean | 是否开启长期策略。 |
| content.indexWsInfo.索引标识.wsInfo.storagePolicy.数据类型.duration | string | 长期保留时长。 |
| content.indexWsInfo.索引标识.indexInfo | object | 普通索引完整实体或default合成子集;历史/远端资料可缺字段,不应整体回传写入。 |
| content.indexWsInfo.索引标识.indexInfo.id | integer 或 null | 来源普通索引的数据库记录编号,默认索引可省略。 |
| content.indexWsInfo.索引标识.indexInfo.uuid | string | lgim_索引配置UUID,默认索引使用default。 |
| content.indexWsInfo.索引标识.indexInfo.workspaceUUID | string | 所属空间。 |
| content.indexWsInfo.索引标识.indexInfo.sourceIndexUUID | string | 克隆索引B的来源A UUID;普通索引为空。 |
| content.indexWsInfo.索引标识.indexInfo.name | string | 来源索引:当前导出索引的名称。 |
| content.indexWsInfo.索引标识.indexInfo.desc | string | 来源索引:当前保存的索引说明。 |
| content.indexWsInfo.索引标识.indexInfo.conditions | string | 来源索引:依据当前extend生成的兼容条件字符串。 |
| content.indexWsInfo.索引标识.indexInfo.sortNo | integer 或 string | 匹配顺序标识;原生直写或克隆通常0。 |
| content.indexWsInfo.索引标识.indexInfo.duration | string | 来源索引:当前保存的标准保留时长字符串,例如7d;TLS的有效阶段详见setting。 |
| content.indexWsInfo.索引标识.indexInfo.isBindCustomStore | integer 或 boolean | 1/true绑定外部存储。 |
| content.indexWsInfo.索引标识.indexInfo.directIndex | integer 或 boolean | 来源索引:当前索引是否为原生直写模式。 |
| content.indexWsInfo.索引标识.indexInfo.isFullLineIndex | integer | 来源索引:当前全文索引模式标记:1为全行索引,0为Message索引。 |
| content.indexWsInfo.索引标识.indexInfo.queryType | string | 查询类别,例如logging/standard或外部SLS返回的模式。 |
| content.indexWsInfo.索引标识.indexInfo.exterStoreProject | string | 外部项目/数据库标识,内部索引通常空。 |
| content.indexWsInfo.索引标识.indexInfo.exterStoreName | string | 外部资源名,内部通常空。 |
| content.indexWsInfo.索引标识.indexInfo.externalResourceAccessCfgUUID | string | 访问配置标识,不是凭据原文。 |
| content.indexWsInfo.索引标识.indexInfo.storeType | string | 内部索引通常空,绑定外部为实际类型。 |
| content.indexWsInfo.索引标识.indexInfo.region | string | 外部地域代码。 |
| content.indexWsInfo.索引标识.indexInfo.isPublicNetworkAccess | integer 或 boolean | 公网访问标记。 |
| content.indexWsInfo.索引标识.indexInfo.status | integer | 0启用、2禁用、3删除。 |
| content.indexWsInfo.索引标识.indexInfo.creator | string | 创建身份。 |
| content.indexWsInfo.索引标识.indexInfo.updator | string | 最近更新身份。 |
| content.indexWsInfo.索引标识.indexInfo.createAt | integer | 创建Unix秒。 |
| content.indexWsInfo.索引标识.indexInfo.updateAt | integer | 更新Unix秒,未更新-1。 |
| content.indexWsInfo.索引标识.indexInfo.deleteAt | integer | 删除Unix秒,未删除-1。 |
| content.indexWsInfo.索引标识.indexInfo.storagePolicy | object | 来源索引:当前保存的长期存储策略对象。 |
| content.indexWsInfo.索引标识.indexInfo.storagePolicy.longStorageEnabled | boolean | 来源索引:是否启用长期存储策略。 |
| content.indexWsInfo.索引标识.indexInfo.storagePolicy.longStorageDuration | string | 来源索引:当前配置的长期总保留时长,单位天,形如90d;关闭时可为空。 |
| content.indexWsInfo.索引标识.indexInfo.setting | object | 来源索引:当前保存的存储专用配置;TLS包含各阶段保留小时数。 |
| content.indexWsInfo.索引标识.indexInfo.setting.hot_retention | integer | 来源索引:TLS热存储阶段小时数。 |
| content.indexWsInfo.索引标识.indexInfo.setting.cold_retention | integer | 来源索引:TLS冷存储阶段小时数,未配置时省略。 |
| content.indexWsInfo.索引标识.indexInfo.setting.archive_retention | integer | 来源索引:TLS归档阶段小时数,未配置时省略。 |
| content.indexWsInfo.索引标识.indexInfo.extend | object | 来源索引:当前保存的匹配条件、关键字段和显示配置。 |
| content.indexWsInfo.索引标识.indexInfo.extend.matchMode | string | 来源索引:条件模式,basic或advanced。 |
| content.indexWsInfo.索引标识.indexInfo.extend.filters | array | 来源索引:basic模式的条件对象数组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.filters[].name | string | 来源索引:条件匹配的原始字段名。 |
| content.indexWsInfo.索引标识.indexInfo.extend.filters[].condition | string | 来源索引:与前一条件的and/or逻辑关系,首项连接符无效。 |
| content.indexWsInfo.索引标识.indexInfo.extend.filters[].operation | string | 来源索引:该条件已保存的比较或匹配运算符。 |
| content.indexWsInfo.索引标识.indexInfo.extend.filters[].value | array | 来源索引:该条件保存的比较值数组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.filters[] | json | 来源索引:一条basic匹配条件。 |
| content.indexWsInfo.索引标识.indexInfo.extend.filters[].value[] | JSON | 来源索引:一个条件值,类型按实际配置。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter | json | 来源索引:advanced模式的条件树根组对象。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.type | string | 来源索引:根组节点类型group。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.condition | string | 来源索引:该组子条件的and/or逻辑关系。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters | array | 来源索引:该组下的子组或条件叶子数组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[] | json | 来源索引:类型为rule的条件叶子或类型为group的子组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[].type | string | 来源索引:rule为条件叶子,group为递归子组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[].name | string | 来源索引:rule叶子匹配的原始字段名。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[].operation | string | 来源索引:rule叶子保存的比较或匹配运算符。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[].value | array | 来源索引:rule叶子的比较值数组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[].condition | string | 来源索引:group子组的and/or逻辑关系。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[].filters | array | 来源索引:group子组的递归子节点数组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.advancedFilter.filters[].value[] | JSON | 来源索引:一个条件比较值,类型按实际配置。 |
| content.indexWsInfo.索引标识.indexInfo.extend.extendFields | array | 来源索引:当前配置的关键字段数组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.extendFields[] | json | 来源索引:一个关键字段及其显示别名。 |
| content.indexWsInfo.索引标识.indexInfo.extend.extendFields[].tag | string | 来源索引:关键字段的原始字段名。 |
| content.indexWsInfo.索引标识.indexInfo.extend.extendFields[].alias | string | 来源索引:关键字段的显示别名。 |
| content.indexWsInfo.索引标识.indexInfo.extend.topFields | array | 来源索引:当前保存的置顶字段显示配置数组。 |
| content.indexWsInfo.索引标识.indexInfo.extend.topFields[] | json | 来源索引:一个置顶字段显示配置。 |
| content.indexWsInfo.索引标识.indexInfo.extend.topFields[].tag | string | 来源索引:置顶字段的原始字段名。 |
| content.indexWsInfo.索引标识.indexInfo.extend.topFields[].alias | string | 来源索引:置顶字段显示别名。 |
| content.indexWsInfo.索引标识.indexInfo.extend.services | array | 来源索引:当前保存的服务显示信息数组,不代替索引匹配条件。 |
| content.indexWsInfo.索引标识.indexInfo.extend.services[] | string | 来源索引:一个服务显示值。 |
| content.indexWsInfo.索引标识.indexInfo.workspaceName | string | 来源空间名称,可省略。 |
| content.indexWsInfo.索引标识.indexInfo.workspaceStatus | integer | 来源空间状态,可省略。 |
| content.indexWsInfo.索引标识.indexInfo.regionCode | string | 来源站点代码。 |
| content.indexWsInfo.索引标识.indexInfo.regionName | string 或 null | 来源站点名称。 |
| content.indexWsInfo.索引标识.indexInfo.grantStatus | integer | 可选,3表示目前授权不可用;未出现不保证其他访问条件满足。 |
| content.relRoleInfos | array<object> |
读取时匹配的角色摘要;*展开有效非Owner角色,指定角色可能返回历史status或{}。 |
| content.relRoleInfos[] | object | 单个角色摘要,找不到可{}。 |
| content.relRoleInfos[].uuid | string | 角色UUID,可省略。 |
| content.relRoleInfos[].name | string | 角色名称,可省略。 |
| content.relRoleInfos[].status | integer | 角色状态,可省略。 |
| content.regionName | string 或 null | 来源站点本地化名称,查不到可能null。 |
| content.declaration | object 或 null | 非空业务对象附带的工作空间公共声明,未配置时可为null或空对象;空对象不添加。 |
{
"code": 200,
"content": {
"id": 100,
"uuid": "lqrl_example",
"workspaceUUID": "wksp_example",
"name": "production_only",
"desc": "仅允许查看生产环境数据。",
"type": "logging",
"indexes": [
"default"
],
"sources": [],
"roleUUIDs": [
"role_example"
],
"conditions": "`env` = 'production'",
"extend": {},
"logic": "and",
"maskFields": "message",
"reExprs": [
{
"name": "token",
"enable": true,
"reExpr": "tkn_[0-9A-Za-z]+"
}
],
"regionCode": "",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"indexWsInfo": {
"default": {
"wsInfo": {},
"indexInfo": {}
}
},
"regionName": "示例站点",
"relRoleInfos": [
{
"uuid": "role_example",
"name": "生产查询",
"status": 0
}
],
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 404 | ft.NotFoundDataQueryRuleCfg | 本空间未找到指定非删除规则,或日志入口目标不是logging | 未找到指定的日志查询规则配置 | 从对应列表重新获取UUID。 |
| 404 | ft.NoInitOtherNodeCfg | 读取或校验远端索引/来源日志索引元数据时未找到可用来源站点地址 | 未初始化其他节点配置 | 由管理员核对来源站点配置、可访问地址及有效跨空间授权,修复后重试。 |
| 500 | ft.InternalServerError | 规则、角色、来源空间或索引/应用元数据读取与格式化失败 | 内部错误 | 刷新已授权来源及站点信息,稍后重试;持续失败提供traceId。 |