생성¶
POST /api/v1/data_query_rule/add
개요¶
단일 데이터 액세스 규칙 생성
Body 요청 파라미터¶
| 파라미터명 | 유형 | 필수 | 설명 |
|---|---|---|---|
| name | string | Y | 이름 빈 값 허용: False 빈 문자열 허용: False 최대 길이: 64 |
| desc | string | 설명 예시: 설명1 빈 값 허용: False 빈 문자열 허용: True 최대 길이: 256 |
|
| type | string | Y | 유형 빈 값 허용: True 可选值: ['logging', 'rum', 'tracing', 'metric'] |
| indexes | array | 로그 유형, 이 필드는 필수, 인덱스 uuid, [""]은 전체를 의미 예시: [''] 빈 값 허용: False |
|
| sources | array | 리소스 uuid, ["*"]은 전체를 의미 예시: ['appid_96357a78f84041d28b5d7aaa6201a424'] 빈 값 허용: False |
|
| roleUUIDs | array | Y | 역할 목록 예시: [] 빈 값 허용: False |
| conditions | string | 필터 검색 예시: search 빈 값 허용: False 빈 문자열 허용: True |
|
| extend | json | 확장 필드 예시: xxx 빈 값 허용: False |
|
| logic | string | 로직 필드 예시: or 빈 값 허용: False |
|
| maskFields | string | 마스킹 필드, 여러 필드는 쉼표(,)로 구분 예시: message,host 빈 값 허용: False 빈 문자열 허용: True |
|
| reExprs | array | 정규 표현식 예시: [{'name': 'jjj', 'reExpr': '', 'enable': 0}, {'name': 'lll', 'reExpr': '', 'enable': 1}] 빈 값 허용: False |
파라미터 추가 설명¶
데이터 설명.*
1. 역할 권한 부여 액세스 설명 1. 지정된 역할은 지정된 쿼리 범위 내의 데이터만 조회 가능 2. 사용자가 여러 역할을 가지고 있는 경우, 해당 사용자에게 이 규칙에 없는 역할이 있다면, 해당 데이터 액세스 규칙은 해당 사용자에게 적용되지 않음, 즉 쿼리 범위가 제한되지 않음 3. 하나의 워크스페이스 내 여러 로그 데이터 액세스 규칙 간의 논리는 or 관계
2. 요청 파라미터 설명
| 파라미터명 | type | 필수 | 설명 |
|---|---|---|---|
| name | string | Y | 이름 |
| desc | String | N | 설명 |
| type | String | Y | 유형(logging, rum, tracing, metric) |
| indexes | array | Y | type이 logging일 때 필수. 현재 워크스페이스가 아닌 인덱스(워크스페이스 권한 부여 필요)에 대한 권한 부여 시, 워크스페이스 UUID:인덱스 UUID 형식 사용, 예: ["wksp_111:lgim_222", "wksp_333:lgim_444"] |
| sources | array | Y | type이 logging이 아닐 때 필수. type이 rum일 때는 앱 appId 목록, type이 tracing일 때는 서비스명 목록, type이 metric일 때는 측정(메저먼트) 목록 |
| roleUUIDs | array | Y | 역할 UUID 목록 |
| conditions | string | N | 실제 사용되는 데이터 범위의 필터 조건, 예: "device IN ['PC'] and session_has_replay IN ['1']" |
| extend | dict | Y | 확장 필드, conditions의 구조적 내용을 저장하며, 프론트엔드 페이지 표시용, 예: |
| logic | string | N | 논리 필드, and/or, 필터 조건 연결에 사용 |
| maskFields | string | N | 마스킹 필드, 여러 필드는 쉼표(,)로 구분 |
| reExprs | array | N | 정규 표현식, 예: [{"name":"1111","enable":true,"reExpr":"tkn_[\da-z]*"},{"name":"liuyltest","enable":true,"reExpr":"test"}] |
요청 예시¶
curl 'https://openapi.guance.com/api/v1/data_query_rule/add' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--data-raw $'{"name":"rum test","desc":"","roleUUIDs":["role_a1e8215c25474f0bb3809f2d56749ed9"],"indexes":[],"sources":["*"],"extend":{"env":["front"]},"maskFields":"*","logic":"and","type":"rum","reExprs":[{"name":"IPv4 Address Scanning","reExpr":"\\\\b((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\\\b","enable":true}],"conditions":"`env` IN [\'front\']"}' \
--compressed
응답¶
{
"code": 200,
"content": {
"conditions": "`env` IN ['front']",
"createAt": 1730532068,
"creator": "wsak_cd83804176e24ac18a8a683260ab0746",
"declaration": {
"asd": "aa,bb,cc,1,True",
"asdasd": "dawdawd",
"business": "aaa",
"dd": "dd",
"fawf": "afawf",
"organization": "64fe7b4062f74d0007b46676"
},
"deleteAt": -1,
"desc": "",
"extend": {
"env": [
"front"
]
},
"id": null,
"indexes": [],
"logic": "and",
"maskFields": "*",
"name": "rum test",
"reExprs": [
{
"enable": true,
"name": "IPv4 Address Scanning",
"reExpr": "\\b((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\b"
}
],
"roleUUIDs": [
"role_a1e8215c25474f0bb3809f2d56749ed9"
],
"sources": [
"*"
],
"status": 0,
"type": "rum",
"updateAt": null,
"updator": null,
"uuid": "lqrl_dfe6330883ef4311afae5d380e2294a1",
"workspaceUUID": "wksp_4b57c7bab38e4a2d9630f675dc20015d"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EF351570-B1E0-4263-87DC-85EE7E9345C5"
}