Skip to content

Modify a Single Data Access Rule



POST /api/v1/data_query_rule/{query_rule_uuid}/modify

Overview

Modify a data access rule as a whole (legacy v2 declaration).

Before calling and usage steps

First read the details, back up the data, and fill in all writable fields. This endpoint replaces the entire rule: omitting desc/indexes/sources/conditions/extend/logic/maskFields/reExprs restores defaults such as empty string/[]/{} respectively. Do not submit only the name and expect other settings 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.

For keyevent event creation, use add_v2 and explicitly specify the current site regionCode. The legacy add/modify omitting regionCode enters cross-site authorization validation with an empty string and usually returns a region error. v2 modify is also shadowed by the legacy route, so the current public modify cannot reliably preserve the site for event rules/cross-site rules. Handle such changes in the console and verify that they actually take effect.

The current v2 declaration has the same Method and URL as the legacy interface; actual HTTP matching hits the legacy entry 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 cannot currently be used to invoke cross-site capabilities. The executable example below uses valid fields of the legacy entry on the same path and does not pass regionCode; the response is also the save result of the legacy entry. For capabilities that require an explicit site, use the reachable general creation endpoint data_query_rule.add_v2 or the console; do not attempt to add a fictional /v2 path.

A write replaces the configuration, commits to the database, then clears the rule cache and records an audit entry; cross-site 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 see whether the changes were saved. After reading back the configuration, handle only modifications or synchronization that have not yet completed.

Saving a rule affects the data query scope/result masking for subsequent matching identities. It does not modify, delete, or backfill raw data, nor does it add basic query permissions for roles. Multiple roles and rules are merged according to query-side policies; final permissions cannot be inferred from a single rule alone. Owner is exempt. The "Data Access Range Restriction" settings for administrators and Workspaces change how unmatched roles are handled. Validate with actual queries from representative members. Saving invalidates the rule cache and cannot guarantee that all in-flight queries switch immediately.

Route Parameters

Parameter Type Required Description
query_rule_uuid string Y Rule UUID in the path. Do not use a name or role UUID. Only non-deleted items in the current Workspace can be read/modified.
Example: lqrl_example
How to obtain or enter: Get it from content.data[].uuid in the Data Access Rule List.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the Workspace.
Example: <DF-API-KEY>
How to obtain or enter: 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 should be non-empty strings; the original declaration does not enforce each item, and an incorrect type can cause a 500.
Example: default
How to obtain or enter: 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_example
How to obtain or enter: A role uuid available in this Workspace, or * alone.
extend.custom key any Any serializable JSON value; not an additional effective condition.
Example: production
How to obtain or enter: Display/edit context defined by the caller, consistent with the actual conditions.
reExprs[*] json It is recommended to use only name/enable/reExpr. The original declaration does not enforce the structure of array elements, and non-objects can cause a 500.
Example: {"name": "token", "enable": true, "reExpr": "tkn_[0-9A-Za-z]+"}
How to obtain or enter: Each object defines one masking expression.
reExprs[*].name string Optional display name; not used as a matching expression; omitting it does not affect regex matching.
Example: token
How to obtain or enter: A business-defined display name for the regex.
reExprs[*].enable boolean Explicit boolean recommended; if omitted, treated as disabled; disabled regexes must still be syntactically valid.
Example: true
How to obtain or enter: true when it needs to be applied; false when stored but not applied.
reExprs[*].reExpr string Non-empty regex recommended. Currently, omission 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 enter: A real sensitive content pattern; when using a JSON string, backslashes must be doubled.
sources[*] string A single source interpreted according to the parent type; a non-empty string is recommended.
Example: monitor
How to obtain or enter: Obtain the real identifier from the corresponding data query result/source list. For event source, do not enter the event ID or monitor UUID.
name string Y Required by the declaration; a non-empty unique name is recommended. An empty string may still enter the automatic naming branch; do not rely on this compatibility behavior. Maximum 64 counting units (ASCII/half-width katakana = 1, other characters = 2); both enabled and disabled rules of the same type participate in duplicate-name checks.
Null allowed: False
Empty string allowed: False
Maximum length: 64
Example: production_only
How to obtain or enter: Name it on the business side; first check existing names of the same type in the Data Access Rule List.
desc string Optional; maximum 256 using the same counting units. If omitted/empty, cleared to empty; a modification does not preserve the original value.
Null allowed: False
Empty string allowed: True
Maximum length: 256
Example: 仅允许查看生产环境数据。
How to obtain or enter: The business side fills in the rule purpose and applicable objects.
regionCode string Y Required by the v2 declaration: the source site code. The Log Indexes in the same rule must belong to the same site and match this value. The legacy entry does not accept this field. Data access rules do not replace cross-site/cross-Workspace authorization; cross-site events must have a valid authorization that includes keyevent or *. Note the actual reachability notes for the duplicate route below.
Null allowed: False
Empty string allowed: False
Example: example-region
How to obtain or enter: Confirm the actual regionCode from the target source site and the valid Cross-Workspace Authorization List; the current site also uses its official code; do not enter the example literal value.
indexes array For log rules, provide explicitly; it is optional in the declaration, but log queries require a valid index range. Omitting it ([]) does not automatically change it to all. ["*"] means all available Log Indexes; * is recommended to be used alone; [] is not all. keyevent forcibly saves []; other non-log types usually use []. You cannot use a regular index name instead of a UUID; authorization is not created automatically; a successful save does not prove that all remote resources are still valid.
Null allowed: False
Example: ["default"]
How to obtain or enter: Get the uuid from the Log Index List; use default for the default Log Index. For cross-Workspace, use the authorized source Workspace UUID:Log Index UUID.
sources array Non-log scope array; ["*"] means all available sources; omitting it ([]) does not mean all. logging forcibly saves []. rum/lineage can be restricted by authorized Workspace UUID:source identifier; tracing/metric/keyevent use raw source strings. keyevent must be a non-empty string array, does not accept wksp_:source, and * cannot be mixed with other values. rum checks whether the application exists only when the current regionCode is explicitly provided; a successful save for other sources does not prove that data exists.
Null allowed: False
Example: ["*"]
How to obtain or enter: For non-log sources, enter the actual data source: for rum, use the appId from the RUM Application List; for tracing, use service; for metric, use the Measurement name; for lineage, use the actual log source; for keyevent, use the event source, such as monitor.
roleUUIDs array Y Required array; ["*"] means all roles; Owner is still not subject to data access restrictions; [] matches no roles and does not mean all. For keyevent events, it must be a non-empty string array; * can only appear alone. For other types, the existence of roles within the scope is validated, but role status=0 is not guaranteed. Basic query permissions must still be granted separately.
Null allowed: False
Example: ["role_example"]
How to obtain or enter: Get the Workspace role uuid from the Role List; use the Workspace Member List to verify a member's actual roles.
conditions string Enter only the filter expression, not the entire query or outer braces. Optional; default is an empty string; an empty string adds no additional filtering. Recommended no more than 4048 characters; keyevent specifically counts Python characters ≤4048 and parses E query syntax; other types are not fully validated for condition semantics when saved, and success does not guarantee future queries will succeed. This rule defines the data range that can be accessed.
Null allowed: False
Empty string allowed: True
Example: `env` = 'production'
How to obtain or enter: Construct DQL filter conditions from the real tags/fields of the target data; validate them first in a query from the same source.
extend json Optional arbitrary JSON display; default {}. There are no unified required child keys or units; the server does not automatically generate conditions from it; modification replaces it as a whole; do not store credentials.
Null allowed: False
Example: {}
How to obtain or enter: The client saves display configuration as needed by its own editor; use {} when not needed.
logic string Compatibility display field, usually and/or; optional. If omitted, saves an empty string; the actually effective filtering uses conditions directly; changing logic does not rewrite conditions; merging of multiple roles/rules is not controlled by this field.
Null allowed: False
Example: and
How to obtain or enter: Keep it consistent with the condition combination method in the client-side filter editor.
maskFields string Optional; default is an empty string, which does not configure field masking for this rule; omitting it on modification clears it. When a field is selected and reExprs=[], non-null values have the entire field masked as ***; when a non-empty regex list is provided, only enabled regexes are applied; disabling all is not equivalent to masking the entire field. Recommended ≤256 characters to fit the storage column.
Null allowed: False
Empty string allowed: True
Example: message
How to obtain or enter: Select actual field names from the query results, separated by English commas, for example message,user_email. When using * to select all, it must be used alone and not mixed with specific fields.
reExprs array Optional; default []; modification replaces it as a whole. Each regex is validated on save, including enable=false items; an invalid regex returns ft.ErrorRegularExpression. Do not use a standalone * to represent any string; use .*. If a selected field has no regex, the entire field is ***; regexes only process matching fragments in string content and replace the matched content with ***. Save validation differs from the execution engine; after a successful save, still verify with representative queries.
Null allowed: False
Example: [{"name": "token", "enable": true, "reExpr": "tkn_[0-9A-Za-z]+"}]
How to obtain or enter: Write a regex executable by Python re according to the sensitive value format; validate it first with masked samples; use it together with maskFields.

Additional Parameter Notes

1. Request parameter description

Parameter type Required Description
name string Y Name
desc String N Description
indexes array Y Required when type is logging. For index authorization from another Workspace (Workspace authorization is required), use Workspace UUID:Log Index UUID, e.g. ["wksp_111:lgim_222", "wksp_333:lgim_444"]
sources array Y Required when type is not logging. When type is rum, it is a list of application appIds; when type is tracing, it is a list of service names; when type is metric, it is a list of Measurement names
roleUUIDs array Y Role UUID list
conditions string N Filter conditions for the data range actually used, e.g. "device IN ['PC'] and session_has_replay IN ['1']"
extend dict Y Extended field that stores the structured content of conditions for frontend display, e.g. {"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, e.g. [{"name":"1111","enable":true,"reExpr":"tkn_[\da-z]*"},{"name":"liuyltest","enable":true,"reExpr":"test"}]
regionCode string Y Site code (can be obtained through the workspace/website/list endpoint)

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/data_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"],"sources":[],"roleUUIDs":["role_example"],"conditions":"`env` = '"'"'production'"'"'","extend":{},"logic":"and","maskFields":"message","reExprs":[{"name":"token","enable":true,"reExpr":"tkn_[0-9A-Za-z]+"}]}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content.id integer or null Record number; the pre-commit snapshot returned on creation may be null; use uuid for subsequent operations.
content.uuid string lqrl_ rule UUID; both modules share the entity and identifier.
content.workspaceUUID string Workspace to which this rule belongs, as distinct from the source Workspace.
content.status integer 0 enabled, 2 disabled, 3 deleted; this module reads only non-deleted items.
content.creator string Creator identity.
content.updator string Most recent updater identity; may be empty initially.
content.createAt integer Creation Unix time in seconds.
content.updateAt integer Update Unix time in seconds; -1 if not updated.
content.deleteAt integer Deletion Unix time in seconds; -1 if not deleted.
content.name string Saved value: required by the declaration; a non-empty unique name is recommended. An empty string may still enter the automatic naming branch; do not rely on this compatibility behavior. Maximum 64 counting units (ASCII/half-width katakana = 1, other characters = 2); both enabled and disabled rules of the same type participate in duplicate-name checks.
content.desc string Saved value: optional; maximum 256 using the same counting units. If omitted/empty, cleared to empty; a modification does not preserve the original value.
content.indexes array Saved value: for log rules, provide explicitly; it is optional in the declaration, but log queries require a valid index range. Omitting it ([]) does not automatically change it to all. ["*"] means all available Log Indexes; * is recommended to be used alone; [] is not all. keyevent forcibly saves []; other non-log types usually use []. You cannot use a regular index name instead of a UUID; authorization is not created automatically; a successful save does not prove that all remote resources are still valid.
content.indexes[] string Saved value: array members should be non-empty strings; the original declaration does not enforce each item, and an incorrect type can cause a 500.
content.roleUUIDs array Saved value: required array; ["*"] means all roles; Owner is still not subject to data access restrictions; [] matches no roles and does not mean all. For keyevent events, it must be a non-empty string array; * can only appear alone. For other types, the existence of roles within the scope is validated, but role status=0 is not guaranteed. Basic query permissions must still be granted separately.
content.roleUUIDs[] string Saved value: a valid role should be used; do not use an account UUID.
content.conditions string Saved value: enter only the filter expression, not the entire query or outer braces. Optional; default is an empty string; an empty string adds no additional filtering. Recommended no more than 4048 characters; keyevent specifically counts Python characters ≤4048 and parses E query syntax; other types are not fully validated for condition semantics when saved, and success does not guarantee future queries will succeed. This rule defines the data range that can be accessed.
content.extend json Saved value: optional arbitrary JSON display; default {}. There are no unified required child keys or units; 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; not an additional effective condition.
content.logic string Saved value: compatibility display field, usually and/or; optional. If omitted, saves an empty string; the actually effective filtering uses conditions directly; changing logic does not rewrite conditions; merging of multiple roles/rules is not controlled by this field.
content.maskFields string Saved value: optional; default is an empty string, which does not configure field masking for this rule; omitting it on modification clears it. When a field is selected and reExprs=[], non-null values have the entire field masked as ***; when a non-empty regex list is provided, only enabled regexes are applied; disabling all is not equivalent to masking the entire field. Recommended ≤256 characters to fit the storage column.
content.reExprs array Saved value: optional; default []; modification replaces it as a whole. Each regex is validated on save, including enable=false items; an invalid regex returns ft.ErrorRegularExpression. Do not use a standalone * to represent any string; use .*. If a selected field has no regex, the entire field is ***; regexes only process matching fragments in string content and replace the matched content with ***. Save validation differs from the execution engine; after a successful save, still verify with representative queries.
content.reExprs[] json Saved value: it is recommended to use only name/enable/reExpr. The original declaration does not enforce the structure of array elements, and non-objects can cause a 500.
content.reExprs[].name string Saved value: optional display name; not used as a matching expression; omitting it does not affect regex matching.
content.reExprs[].enable boolean Saved value: explicit boolean recommended; if omitted, treated as disabled; disabled regexes must still be syntactically valid.
content.reExprs[].reExpr string Saved value: non-empty regex recommended. Currently, omission is checked as an empty string; do not rely on the server to complete a valid expression.
content.sources array Saved value: non-log scope array; ["*"] means all available sources; omitting it ([]) does not mean all. logging forcibly saves []. rum/lineage can be restricted by authorized Workspace UUID:source identifier; tracing/metric/keyevent use raw source strings. keyevent must be a non-empty string array, does not accept wksp_:source, and * cannot be mixed with other values. rum checks whether the application exists only when the current regionCode is explicitly provided; a successful save for other sources does not prove that data exists.
content.sources[] string Saved value: a single source interpreted according to the parent type; a non-empty string is recommended.
content.type string Saved value: required for creation: logging/rum/tracing/metric/lineage/keyevent; the declaration allows null, but an invalid type cannot form a normal query rule, so always submit one of the above strings. Modification does not accept type and uses the stored type.
content.regionCode string Saved value: required by the v2 declaration: the source site code. The Log Indexes in the same rule must belong to the same site and match this value. The legacy entry does not accept this field. Data access rules do not replace cross-site/cross-Workspace authorization; cross-site events must have a valid authorization that includes keyevent or *. Note the actual reachability notes for the duplicate route below.
content.declaration object or null Workspace public declaration attached to a non-empty business object; when not configured, it may be null or an empty object; an empty object is not added. The exact pagination position is based on the structure on this page.
{
  "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 Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed Request field missing, or field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
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 site address was found while reading or validating remote index/RUM application metadata Other node configuration not initialized Ask the administrator to check the source site configuration, accessible address, 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 Name already exists Change the name, or verify and update the existing UUID.
400 ft.ErrorRegularExpression Any regex is invalid, including disabled items Regular expression error Fix all reExpr values before submitting; do not use a standalone *.
400 ft.InvalidRoleUUID The role is not within the Workspace scope, or the keyevent role array is invalid Invalid role UUID: {} Get a valid identifier from this Workspace's role list; for events, use * alone.
400 ft.InvalidLoggingIndex The resolved regular index in the source Workspace of the current site does not exist or has been deleted Invalid index:{} Use a valid Log Index UUID/default and check authorization.
400 ft.InvalidRegionDataQueryRuleIndex Log Indexes are mixed across multiple sites or the site does not match; cross-site events lack valid authorization Invalid site index information: {} Create rules per site and verify the source and target from the authorization records.
500 ft.InternalServerError Array item shape mismatch, field exceeds storage length, downstream common 5xx, database failure, or post-commit cache failure Internal error Check the structure and lengths in this document, read the current configuration to confirm whether it has been persisted, then decide whether to retry and provide traceId.
400 ft.InvalidSources The keyevent source structure is invalid, or the rum source application for the explicit current site does not exist Invalid resource information:{} For events, provide a non-empty source string array and use * alone; for RUM, take appId from a valid application.
406 ft.InvalidParameter keyevent conditions is not a string or exceeds 4048 characters Parameter {} is invalid Use a DQL condition string of compliant length.
406 ft.DqlParseError keyevent conditions cannot be parsed dql parser parsing failed: {} Validate the filter conditions in an event query and retain the original error and traceId.
404 ft.NotFoundDataQueryRuleCfg The target rule does not exist, has been deleted, or does not belong to the current Workspace; this general entry point is not additionally limited to logging rules. Specified log query rule configuration not found Get the UUID again from the correct module list.

Feedback

Is this page helpful?