Modify a Single Data Access Rule¶
POST /api/v1/logging_query_rule/{logging_query_rule_uuid}/modify
Overview¶
Fully modifies a log access rule (legacy v2 declaration).
Before Calling and Usage Steps¶
First read the details, back up the record, and fill in all writable fields. This API replaces the record as a whole: omitting desc/indexes/conditions/extend/logic/maskFields/reExprs restores the defaults such as empty string/[]/{} respectively, so you cannot submit only the name and expect the other configurations to remain unchanged; if regionCode is not passed, an empty string is saved. The type follows the original record and cannot be changed through this body.
The current v2 declaration has the same Method and URL as the legacy endpoint, and actual HTTP requests match the legacy entry point first; passing regionCode returns ft.ParameterValidationFailed as an unknown body field. The regionCode in the declaration table on this page reflects the historical v2 contract, and you cannot use it to call cross-region capabilities at present. The executable examples below use the legal fields of the legacy entry point at the same path without passing regionCode; the responses are also the save results of the legacy entry point. For capabilities that require an explicit region, use the reachable general-purpose create API data_query_rule.add_v2 or the console, and do not attempt to add a fictitious /v2 path.
A write replaces the configuration, commits it to the database, then clears the rule cache and records an audit entry; cross-region validation may also read/update resource data. The steps are not a single atomic transaction. After a 500/timeout, first check the list/details to confirm whether the record has been saved, read it back by the original UUID, and then handle only the unfinished modifications.
Saving a rule affects the data query scope/result masking of subsequent matching identities; it does not modify, delete, or backfill raw data, nor does it add the basic query permissions of roles. Multiple roles and rules are merged by the query-side policy, so the final permission cannot be inferred from a single rule; Owner is exempt, and the administrator and the workspace's "data access scope restriction" setting change how non-matching roles are handled. Acceptance should be performed with actual queries from a representative member. Saving invalidates the rule cache, and it is not guaranteed that all in-flight queries switch over immediately.
Route Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| logging_query_rule_uuid | string | Y | Path rule UUID; a name or role UUID cannot be used; read/modify applies only to non-deleted items in the current workspace. Example: lqrl_exampleHow to obtain or fill in: Get it from content.data[].uuid in the Log Access Rule List. |
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential of the workspace. Example: <DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| indexes[*] | string | Array members are recommended to be non-empty strings; the original declaration does not enforce this per item, and a wrong type can cause a 500. Example: defaultHow to obtain or fill in: A single log index UUID/default, or an authorized wksp_source:lgim_index. |
|
| roleUUIDs[*] | string | A valid role should be used; do not use an account UUID. Example: role_exampleHow to obtain or fill in: A role UUID available in this workspace, or a standalone *. |
|
| extend.custom key | any | Any serializable JSON value; it is not an additional effective condition. Example: productionHow to obtain or fill in: Display/edit context defined by the caller, kept consistent with the actual conditions. |
|
| reExprs[*] | json | Only name/enable/reExpr are recommended; the original declaration does not enforce the structure of array elements, and a non-object can cause a 500. Example: {"name": "token", "enable": true, "reExpr": "tkn_[0-9A-Za-z]+"}How to obtain or fill in: Each object defines one masking expression. |
|
| reExprs[*].name | string | Optional display name; it is not used as the matching expression, and omitting it does not affect regular expression matching. Example: tokenHow to obtain or fill in: A business-defined display name for the regular expression. |
|
| reExprs[*].enable | boolean | An explicit boolean is recommended; when missing, the expression is treated as not enabled; a disabled regular expression must still be syntactically valid. Example: trueHow to obtain or fill in: true when it needs to be applied, false when it is staged but not applied. |
|
| reExprs[*].reExpr | string | A non-empty regular expression is recommended. Currently a missing value is checked as an empty string; do not rely on the server to complete a valid expression. Example: tkn_[0-9A-Za-z]+How to obtain or fill in: The real sensitive content pattern; when using a JSON string, backslashes must be doubled. |
|
| name | string | Can be omitted; when missing/empty string, an attempt is made to generate it from the calling identity's display name and the current Unix second, and modification regenerates it as well without keeping the old name. Maximum 64 counting units (ASCII/half-width katakana = 1, other characters = 2); both enabled and disabled rules of the same type participate in the duplicate name check. Allows null: False Allows empty string: False Maximum length: 64 Example: production_onlyHow to obtain or fill in: Named by the business side; first check the existing names of the same type in the Log Access Rule List. |
|
| desc | string | Optional, at most 256 of the same counting units; missing/empty string clears it to empty; modification does not keep the original value. Allows null: False Allows empty string: True Maximum length: 256 Example: 仅允许查看生产环境数据。How to obtain or fill in: The business side fills in the purpose of the rule and its applicable objects. |
|
| regionCode | string | Y | Required source region code in the v2 declaration; the log indexes of the same rule must belong to the same region and be consistent with this value. The legacy entry point does not accept this field. A data access rule does not replace cross-region/cross-workspace authorization; cross-region events require a valid authorization containing keyevent or *. Note the actual reachability description for the duplicate route below. Allows null: False Allows empty string: False Example: example-regionHow to obtain or fill in: Confirm the real regionCode from the target source region and the valid Cross-Workspace Authorization List; the current region also uses its official code, so do not enter the example literal value. |
| indexes | array | Y | Log index identifier array, required in this module; ["*"] means all available log indexes, and * is recommended to be used alone; [] does not mean all. Use a UUID for a regular index, not a name; saving a rule does not create workspace or region authorization.Allows null: False Example: ["default"]How to obtain or fill in: Get the uuid from the Log Index List, and the default index uses default; for cross-workspace, use the authorized source workspace UUID:index UUID. |
| roleUUIDs | array | Y | Required role UUID array; ["*"] means all roles, and [] matches no role; Owner is still not subject to data access restrictions. A regular UUID is validated for existence within the scope, but its status is not guaranteed to be 0; basic query permission must still be held separately.Allows null: False Example: ["role_example"]How to obtain or fill in: Get the uuid of a role in this workspace from the Role List; you can verify a member's actual roles with the Workspace Member List. |
| conditions | string | Y | Required log filter expression; it is not the whole query or the outer braces; 4048 characters or fewer is recommended. The current logging path does not fully parse the E query rules of keyevent, and a successful save does not guarantee that all subsequent queries can be executed. Allows null: False Example: `env` = 'production'How to obtain or fill in: Build the DQL filter condition from the real tags/fields of the target data; first verify it with a query on the same source. |
| extend | json | Optional arbitrary JSON echo, default {}; there is no unified required subkey or unit, and the server does not automatically generate conditions from it; modification replaces it as a whole; do not store credentials. Allows null: False Example: {}How to obtain or fill in: The client saves the display configuration required by its own editor; use {} when not needed. |
|
| logic | string | Compatibility echo field, usually and/or; required in the create declaration, optional for modification. Omitting it saves an empty string; the actually effective filter uses conditions directly, changing logic does not rewrite the condition, and the merging of multiple roles/rules is not controlled by this field. Allows null: False Example: andHow to obtain or fill in: Keep it consistent with the condition combination method in the client's filter editor. |
|
| maskFields | string | Optional; the default empty string means no field masking is configured for this rule; omitting it on modification clears it. When a field is selected and reExprs=[], non-null values have the whole field masked as ***; when a non-empty regular expression list is provided, only enabled expressions are applied, and disabling all of them is not the same as whole-field masking. 256 characters or fewer is recommended to fit the storage column. Allows null: False Allows empty string: True Example: messageHow to obtain or fill in: Choose from the actual field names in the query results and separate multiple fields with English commas, for example message,user_email; when * is used to select all, it must be used alone and not mixed with specific fields. |
|
| reExprs | array | Optional, default []; modification replaces it as a whole. On save, every regular expression is validated, including items with enable=false; an invalid expression returns ft.ErrorRegularExpression. Do not use a standalone * to mean any string; use .*. When a selected field has no regular expression, the whole field is ***; a regular expression only processes matching fragments of string content and replaces the matched content with ***; save-time validation differs from the execution engine, so after a successful save you still need to verify with a representative query. Allows null: False Example: [{"name": "token", "enable": true, "reExpr": "tkn_[0-9A-Za-z]+"}]How to obtain or fill in: Write a regular expression executable by Python re according to the sensitive value format, and verify it first with masked samples; use it together with maskFields. |
Additional Parameter Notes¶
Data notes.*
1. Role authorization access notes 1. A specified role can only query data within the specified query scope. 2. If a user has multiple roles and one of the user's roles is not among the roles of this rule, this data access rule does not take effect for that user, that is, the query scope is not restricted. 3. Multiple log data access rules in a workspace are related by OR logic.
2. Request parameter notes
| Parameter | type | Required | Description |
|---|---|---|---|
| name | string | Y | Name |
| desc | String | N | Description |
| indexes | array | Y | Log index information; for an index authorization of a non-current workspace (which must go through workspace authorization), use workspace UUID:index UUID, for example: ["wksp_111:lgim_222", "wksp_333:lgim_444"] |
| roleUUIDs | array | Y | List of role UUIDs |
| conditions | string | N | Filter condition of the actually used data scope, for example: "device IN ['PC'] and session_has_replay IN ['1']" |
| extend | dict | Y | Extension field that stores the structured content of conditions for frontend page display, for example: {"device": [ "PC"], "session_has_replay": [1]} |
| logic | string | N | Logic field, and/or, used to connect filter conditions |
| maskFields | string | N | Masked fields; separate multiple fields with commas |
| reExprs | array | N | Regular expressions, for example: [{"name":"1111","enable":true,"reExpr":"tkn_[\da-z]*"},{"name":"liuyltest","enable":true,"reExpr":"test"}] |
| regionCode | string | Y | Region code (can be obtained through the workspace/website/list API), that is, the region information of the data access configuration; data of the current region is authorized by default |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/logging_query_rule/lqrl_example/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"production_only","desc":"仅允许查看生产环境数据。","indexes":["default"],"roleUUIDs":["role_example"],"conditions":"`env` = '"'"'production'"'"'","extend":{},"logic":"and","maskFields":"message","reExprs":[{"name":"token","enable":true,"reExpr":"tkn_[0-9A-Za-z]+"}]}'
Responses¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer | Database ID of the existing log data access rule; calls use the uuid. |
| content.uuid | string | lqrl_rule UUID; both modules share the same entity and identifier. |
| content.workspaceUUID | string | Workspace that owns this rule, as distinct from the source workspace. |
| content.status | integer | 0 enabled, 2 disabled, 3 deleted; reads in this module return only non-deleted items. |
| content.creator | string | Creator identity. |
| content.updator | string | Identity of the most recent update; may be empty initially. |
| content.createAt | integer | Creation time in Unix seconds. |
| content.updateAt | integer | Update time in Unix seconds; -1 if never updated. |
| content.deleteAt | integer | Deletion time in Unix seconds; -1 if not deleted. |
| content.name | string | Saved value: can be omitted; when missing/empty string, an attempt is made to generate it from the calling identity's display name and the current Unix second, and modification regenerates it as well without keeping the old name. Maximum 64 counting units (ASCII/half-width katakana = 1, other characters = 2); both enabled and disabled rules of the same type participate in the duplicate name check. |
| content.desc | string | Saved value: optional, at most 256 of the same counting units; missing/empty string clears it to empty; modification does not keep the original value. |
| content.indexes | array | Currently saved log index identifier array; ["*"] means all available log indexes; still subject to the actual source authorization. |
| content.indexes[] | string | Saved value: array members are recommended to be non-empty strings; the original declaration does not enforce this per item, and a wrong type can cause a 500. |
| content.roleUUIDs | array | Currently saved applicable role UUID array; ["*"] means all roles, and [] matches no role; basic permission must still be held separately. |
| content.roleUUIDs[] | string | Saved value: a valid role should be used; do not use an account UUID. |
| content.conditions | string | Currently saved log filter expression; this read does not re-run the event E query validation. |
| content.extend | json | Saved value: optional arbitrary JSON echo, default {}; there is no unified required subkey or unit, and the server does not automatically generate conditions from it; modification replaces it as a whole; do not store credentials. |
| content.extend.custom key | any | Saved value: any serializable JSON value; it is not an additional effective condition. |
| content.logic | string | Saved value: compatibility echo field, usually and/or; required in the create declaration, optional for modification. Omitting it saves an empty string; the actually effective filter uses conditions directly, changing logic does not rewrite the condition, and the merging of multiple roles/rules is not controlled by this field. |
| content.maskFields | string | Saved value: optional; the default empty string means no field masking is configured for this rule; omitting it on modification clears it. When a field is selected and reExprs=[], non-null values have the whole field masked as ***; when a non-empty regular expression list is provided, only enabled expressions are applied, and disabling all of them is not the same as whole-field masking. 256 characters or fewer is recommended to fit the storage column. |
| content.reExprs | array | Saved value: optional, default []; modification replaces it as a whole. On save, every regular expression is validated, including items with enable=false; an invalid expression returns ft.ErrorRegularExpression. Do not use a standalone * to mean any string; use .*. When a selected field has no regular expression, the whole field is ***; a regular expression only processes matching fragments of string content and replaces the matched content with ***; save-time validation differs from the execution engine, so after a successful save you still need to verify with a representative query. |
| content.reExprs[] | json | Saved value: only name/enable/reExpr are recommended; the original declaration does not enforce the structure of array elements, and a non-object can cause a 500. |
| content.reExprs[].name | string | Saved value: optional display name; it is not used as the matching expression, and omitting it does not affect regular expression matching. |
| content.reExprs[].enable | boolean | Saved value: an explicit boolean is recommended; when missing, the expression is treated as not enabled; a disabled regular expression must still be syntactically valid. |
| content.reExprs[].reExpr | string | Saved value: a non-empty regular expression is recommended. Currently a missing value is checked as an empty string; do not rely on the server to complete a valid expression. |
| content.sources | array | Compatibility entity field; a log-specific create saves it as an empty array, and a modification does not assign it and keeps the existing content; this API does not accept sources input. |
| content.sources[] | string | Saved value: a single source interpreted according to the parent type; a non-empty string is recommended. |
| content.type | string | Fixed to logging; this log-specific API does not accept type input. |
| content.regionCode | string | Currently saved log source region code; a historical empty string is treated as the current region; it does not mean a source authorization was created. |
| content.declaration | object or null | Workspace common declaration attached to a non-empty business object; it may be null or an empty object when not configured; an empty object is not added. |
{
"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": "wsak_example",
"createAt": 1785427200,
"updateAt": 1785427300,
"deleteAt": -1,
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation conditions | Parameter parsing failed | Verify the parameter location, field names, types, and values. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 404 | ft.NoInitOtherNodeCfg | No available source region address was found when reading or validating remote index/RUM application metadata | Other node configurations are not initialized | Have an administrator verify the source region configuration, accessible addresses, and valid cross-workspace authorization, then retry after fixing. |
| 400 | ft.NameRepeat | A non-deleted rule with the same name and type exists in this workspace | The name already exists | Change the name, or update the existing UUID after verification. |
| 400 | ft.ErrorRegularExpression | Any regular expression is invalid, including disabled items | Invalid regular expression | Fix all reExpr values, then submit; do not use a standalone *. |
| 400 | ft.InvalidRoleUUID | The given role UUID is not within the allowed workspace scope, or the role identifier is invalid | Invalid role UUID: {} | Obtain a valid identifier from the current workspace's role list; when all roles are needed, explicitly use the wildcard configuration supported on this page, and do not enter an account UUID. |
| 400 | ft.InvalidLoggingIndex | The resolved regular index of the source workspace in the current region does not exist or has been deleted | Invalid index:{} | Use a valid index UUID/default and verify the authorization. |
| 400 | ft.InvalidRegionDataQueryRuleIndex | The indexes of this log rule mix multiple regions, or the index region does not match the source region | {} region index information is invalid | Configure each region separately, and verify the source authorization and region of each log index. |
| 500 | ft.InternalServerError | Array item shape mismatch, a field exceeding the storage length, an ordinary downstream 5xx, or a database or post-commit cache failure | Internal error | Verify the structure and lengths described in this document, read the current configuration to confirm whether it has been persisted, and then decide whether to retry; provide the traceId. |
| 404 | ft.NotFoundDataQueryRuleCfg | The target rule does not exist or has been deleted in this workspace; the log entry point is also restricted to logging | The specified log query rule configuration was not found | Obtain the UUID again from the correct module list. |