Skip to content

Modify Data Access Rule



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

Overview

Modifies a data access rule as a whole.

Before You Call and Usage Steps

First read the details, back up, and fill in all writable fields. This API replaces the entire record: omitting desc/indexes/sources/conditions/extend/logic/maskFields/reExprs restores their defaults such as empty string/[]/{} respectively; you cannot submit only the name and expect 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.

For creating keyevent events, it is recommended to use add_v2 and explicitly specify the current site regionCode; the legacy add/modify omits regionCode, which enters cross-site authorization validation as an empty string and usually returns a region error. The modify v2 is again shadowed by the legacy route, so the current public modify cannot reliably preserve the site of event rules/cross-site rules; for such changes, handle them from the console and verify what actually takes effect.

This legacy entry point does not accept regionCode; when it is not provided, an empty string is saved and interpreted by read/query as the current site. Avoid using it to modify rules that need to preserve an explicit source site.

Writes replace the configuration, commit to the database, then clear the rule cache and record an audit entry; cross-site validation may also read/update resource profiles. The steps are not a single atomic transaction. After a 500/timeout, first check the list/details to see whether the change has been saved, then read back the configuration and only handle modifications or synchronization that have not yet completed.

Saving a rule affects the data query scope/result masking for subsequent identities that match the conditions; 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, so the final permissions cannot be inferred from a single rule alone; Owner is exempt, and the administrator and workspace "data access scope restriction" settings change how non-matching roles are handled, so verify with actual queries from a representative member. After saving, the rule cache is invalidated, but in-flight queries are not guaranteed to switch immediately.

Route Parameters

Parameter Name Type Required Description
query_rule_uuid string Y Path rule UUID; do not use a name or role UUID. Read/modify applies only to non-deleted items in the current workspace.
Example: lqrl_example
How to get or fill: Obtain from content.data[].uuid in the Data Access Rule List.

Request Headers

Parameter Name Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to get or fill: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace.

Body Request Parameters

Parameter Name 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 get or fill: A single log index uuid/default, or an authorized wksp_source:lgim_index.
roleUUIDs[*] string Use a valid role; do not use an account UUID.
Example: role_example
How to get or fill: A role uuid available in the current workspace, or a standalone *.
extend.custom key any Any serializable JSON value; it is not an additional effective condition.
Example: production
How to get or fill: A display/edit context defined by the caller, kept 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 a non-object can cause a 500.
Example: {"name": "token", "enable": true, "reExpr": "tkn_[0-9A-Za-z]+"}
How to get or fill: Each object defines one masking expression.
reExprs[*].name string Optional display name; not used as a match expression; omitting it does not affect regex matching.
Example: token
How to get or fill: A custom display name for the regex.
reExprs[*].enable boolean An explicit boolean is recommended; when omitted, it is treated as not enabled. A disabled regex must still be syntactically valid.
Example: true
How to get or fill: true when it needs to be applied, false when saved but not applied.
reExprs[*].reExpr string A non-empty regex is recommended. Currently, when omitted it 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 get or fill: The actual 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 get or fill: Obtain the real identifier from the corresponding data query result/source list. For event source, do not fill in the event ID or monitor UUID.
name string Y Declared required; 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 count units (ASCII/half-width katakana 1, other characters 2); both enabled and disabled rules of the same type participate in the duplicate name check.
Allow null: False
Allow empty string: False
Maximum length: 64
Example: production_only
How to get or fill: Named by the business side; first check existing names of the same type from the Data Access Rule List.
desc string Optional; maximum 256 using the same count units; when omitted/an empty string, it is cleared to empty; modify does not preserve the original value.
Allow null: False
Allow empty string: True
Maximum length: 256
Example: Only allow viewing production environment data.
How to get or fill: The business side fills in the purpose and applicable objects of the rule.
indexes array Should be explicitly provided for log rules; declared optional, but log queries require a valid index scope, and omitting it as [] is not automatically changed to all. ["*"] means all available log indexes; it is recommended to use * alone; [] is not all. keyevent forcibly saves []; other non-log types usually use []. A regular index name cannot replace a UUID and does not automatically create authorization; a successful save does not prove that all remote resources are still valid.
Allow null: False
Example: ["default"]
How to get or fill: Get the uuid from the Log Index List; the default index uses default. For cross-workspace, use authorized source workspace UUID:index UUID.
sources array Array of non-log scopes; ["*"] means all available sources; omitting it as [] does not mean all. logging forcibly saves []. rum/lineage can be limited by authorized workspace UUID:source identifier; tracing/metric/keyevent use the original source string. keyevent must be a non-empty string array, does not accept wksp_:source, and * cannot be mixed with other values. For rum, the existence of the application is verified only when the current regionCode is explicit; a successful save for other sources does not prove that data actually exists.
Allow null: False
Example: ["*"]
How to get or fill: For non-log types, fill in the real 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, and Owner is still not subject to data access restrictions; [] matches no role and is not equal to all. Event keyevent must be a non-empty string array, and * can only appear alone; other types validate that roles exist within the scope, without guaranteeing role status=0. Basic query permissions must still be held separately.
Allow null: False
Example: ["role_example"]
How to get or fill: Get the current workspace role uuid from the Role List; you can use the Workspace Member List to verify the actual roles of members.
conditions string Fill in only the filter expression, not the entire query or outer braces. Optional, defaults to an empty string; an empty string adds no extra filtering. It is recommended not to exceed 4048 characters; keyevent specifically checks that the Python character count is ≤4048 and parses the E query syntax, while other types do not fully validate the semantics of conditions when saving, and success does not guarantee that future queries will succeed. This rule defines the data scope that is allowed to be accessed.
Allow null: False
Allow empty string: True
Example: `env` = 'production'
How to get or fill: Construct a 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 for display, defaults to {}; there are no unified required sub-keys or units, the server does not automatically generate conditions from it, and modify replaces it entirely; do not store credentials.
Allow null: False
Example: {}
How to get or fill: The client saves the display configuration according to its own editor requirements; use {} when not needed.
logic string Compatibility display field, usually and/or; optional. When omitted, an empty string is saved; the actually effective filtering directly uses conditions, changing logic does not rewrite conditions, and multi-role/multi-rule merging is not controlled by this field.
Allow null: False
Example: and
How to get or fill: Keep it consistent with the condition combination method in the client filter editor.
maskFields string Optional; the default empty string means field masking is not configured for this rule; omitting it on modify clears it. When fields are selected and reExprs=[], non-null values are masked entirely as ***; when a non-empty regex list is given, only enabled regexes are applied, and disabling all is not the same as full-field masking. It is recommended to use ≤256 characters to fit the storage column.
Allow null: False
Allow empty string: True
Example: message
How to get or fill: Select 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, defaults to [], and modify replaces it entirely. Each regex is validated on save, including items with enable=false; an invalid regex returns ft.ErrorRegularExpression. Do not use a standalone * to mean any string; use .*. When fields are selected and there is no regex, the entire field is ***; regexes only process matching fragments of string content and replace 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.
Allow null: False
Example: [{"name": "token", "enable": true, "reExpr": "tkn_[0-9A-Za-z]+"}]
How to get or fill: Write a regex 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

1. Request parameter description

Parameter Name type Required Description
name string Y Name
desc String N Description
indexes array Y Required when type is logging. For index authorization outside the current workspace (workspace authorization is required), use workspace UUID: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, a list of service names; when type is metric, a list of measurements
roleUUIDs array Y List of role UUIDs
conditions string N Filter condition for the data scope actually used, e.g. "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, e.g. {"device": [ "PC"], "session_has_replay": [1]}
logic string N Logic field, and/or, used to join 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"}]

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":"Only allow viewing production environment data.","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 ID; the snapshot returned at creation before commit may be null, so use uuid for subsequent operations.
content.uuid string lqrl_ rule UUID; both modules share the same entity and identifier.
content.workspaceUUID string Workspace that this rule belongs to, distinct from the source workspace.
content.status integer 0 enabled, 2 disabled, 3 deleted; reads in this module cover only non-deleted items.
content.creator string Creating identity.
content.updator string Last updating identity; may be empty initially.
content.createAt integer Creation Unix seconds.
content.updateAt integer Update Unix seconds; -1 if never updated.
content.deleteAt integer Deletion Unix seconds; -1 if not deleted.
content.name string Saved value: declared required; 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 count 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; maximum 256 using the same count units; when omitted/an empty string, it is cleared to empty; modify does not preserve the original value.
content.indexes array Saved value: should be explicitly provided for log rules; declared optional, but log queries require a valid index scope, and omitting it as [] is not automatically changed to all. ["*"] means all available log indexes; it is recommended to use * alone; [] is not all. keyevent forcibly saves []; other non-log types usually use []. A regular index name cannot replace a UUID and does not automatically create authorization; 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, and Owner is still not subject to data access restrictions; [] matches no role and is not equal to all. Event keyevent must be a non-empty string array, and * can only appear alone; other types validate that roles exist within the scope, without guaranteeing role status=0. Basic query permissions must still be held separately.
content.roleUUIDs[] string Saved value: use a valid role; do not use an account UUID.
content.conditions string Saved value: fill in only the filter expression, not the entire query or outer braces. Optional, defaults to an empty string; an empty string adds no extra filtering. It is recommended not to exceed 4048 characters; keyevent specifically checks that the Python character count is ≤4048 and parses the E query syntax, while other types do not fully validate the semantics of conditions when saving, and success does not guarantee that future queries will succeed. This rule defines the data scope that is allowed to be accessed.
content.extend json Saved value: optional arbitrary JSON for display, defaults to {}; there are no unified required sub-keys or units, the server does not automatically generate conditions from it, and modify replaces it entirely; 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 display field, usually and/or; optional. When omitted, an empty string is saved; the actually effective filtering directly uses conditions, changing logic does not rewrite conditions, and multi-role/multi-rule merging is not controlled by this field.
content.maskFields string Saved value: optional; the default empty string means field masking is not configured for this rule; omitting it on modify clears it. When fields are selected and reExprs=[], non-null values are masked entirely as ***; when a non-empty regex list is given, only enabled regexes are applied, and disabling all is not the same as full-field masking. It is recommended to use ≤256 characters to fit the storage column.
content.reExprs array Saved value: optional, defaults to [], and modify replaces it entirely. Each regex is validated on save, including items with enable=false; an invalid regex returns ft.ErrorRegularExpression. Do not use a standalone * to mean any string; use .*. When fields are selected and there is no regex, the entire field is ***; regexes only process matching fragments of string content and replace 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: it is recommended to use only name/enable/reExpr; 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; not used as a match expression; omitting it does not affect regex matching.
content.reExprs[].enable boolean Saved value: an explicit boolean is recommended; when omitted, it is treated as not enabled. A disabled regex must still be syntactically valid.
content.reExprs[].reExpr string Saved value: a non-empty regex is recommended. Currently, when omitted it is checked as an empty string; do not rely on the server to complete a valid expression.
content.sources array Saved value: array of non-log scopes; ["*"] means all available sources; omitting it as [] does not mean all. logging forcibly saves []. rum/lineage can be limited by authorized workspace UUID:source identifier; tracing/metric/keyevent use the original source string. keyevent must be a non-empty string array, does not accept wksp_:source, and * cannot be mixed with other values. For rum, the existence of the application is verified only when the current regionCode is explicit; a successful save for other sources does not prove that data actually 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 on create: 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. Modify does not accept type and follows the stored type.
content.regionCode string Saved value: the v2 declaration requires the source site code; the log indexes of the same rule must belong to the same site and be consistent with this value. The legacy entry point 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 description below about the actual reachability of the duplicated route.
content.declaration object or null Workspace common declaration attached to non-empty business objects; it may be null or an empty object when not configured; an empty object is not added. The exact position of pagination is subject to the structure of this page.
{
  "code": 200,
  "content": {
    "id": 100,
    "uuid": "lqrl_example",
    "workspaceUUID": "wksp_example",
    "name": "production_only",
    "desc": "Only allow viewing production environment data.",
    "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 A request field is missing, or the field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError The request JSON syntax is invalid Request JSON format error Fix the JSON according to content.reason, line, and column.
404 ft.NoInitOtherNodeCfg No available source site address was found when reading or validating remote index/RUM application metadata Other node configuration not initialized Have the administrator check the source site configuration, accessible addresses, and valid cross-workspace authorization, then retry after fixing.
400 ft.NameRepeat A non-deleted rule of the same type with the same name exists in the current workspace Name already exists Change the name, or update the existing UUID after verification.
400 ft.ErrorRegularExpression Any regex is invalid, including disabled items Regular expression error Fix all reExpr and submit again; 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: {} Take a valid identifier from the current workspace role list; use * alone for events.
400 ft.InvalidLoggingIndex The regular index in the resolved source workspace of the current site does not exist/is deleted Invalid index:{} Use a valid index UUID/default and verify the authorization.
400 ft.InvalidRegionDataQueryRuleIndex Log indexes mix multiple sites or the site does not match; the cross-site event has no valid authorization {} site index information is invalid Create rules per site and verify the source and target from the authorization records.
500 ft.InternalServerError Array item shape mismatch, field exceeds the storage length, ordinary downstream 5xx, database or post-commit cache failure Internal error Check the structure and lengths in this document and read the current configuration to confirm whether it has been persisted, then decide whether to retry, and provide the traceId.
400 ft.InvalidSources The keyevent source structure is invalid, or the explicitly specified current site rum source application does not exist Invalid resource information:{} Provide a non-empty source string array for events and use * alone; get the appId from a valid RUM 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 condition in an event query and keep 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 generic entry point is not additionally restricted to logging rules. The specified log query rule configuration was not found Obtain the UUID again from the correct module list.

Feedback

Is this page helpful?