Skip to content

Modify



POST /api/v1/logging_query_rule/{logging_query_rule_uuid}/modify

Overview

Modifies a log access rule as a whole.

Before You Call and Usage Steps

First read the details, back up the rule, and backfill all writable fields. This API replaces the rule as a whole: if desc/indexes/conditions/extend/logic/maskFields/reExprs are omitted, they are reset to defaults such as an empty string/[]/{}; you cannot submit only 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.

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

Writing 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 metadata. The steps are not a single atomic transaction. After a 500/timeout, first check the list/details to verify whether the configuration has been saved, read it back by the original UUID, and handle only the incomplete changes.

Rule saving 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 base query permissions for roles. Multiple roles and rules are merged according to query-side policies, and final permissions cannot be inferred from a single rule alone. Owner is exempt. The administrator and workspace "Data Access Scope Restriction" settings change how unmatched roles are handled, so acceptance should use actual queries from representative members. After saving, the rule cache is invalidated, but in-flight queries are not guaranteed to switch immediately.

Route Parameters

Parameter Name Type Required Description
logging_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 obtain or fill in: Obtain from content.data[].uuid in the Log 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 obtain or fill in: Obtain an OpenAPI Key with permission for this operation 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 this per item, and an incorrect type can cause a 500.
Example: default
How to obtain or fill in: 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 obtain or fill in: A role UUID available in the current workspace, or * alone.
extend.custom_key any Any serializable JSON value; not an additional effective condition.
Example: production
How to obtain or fill in: A display/edit context defined by the caller and 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 element 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 can be omitted without affecting regex matching.
Example: token
How to obtain or fill in: A custom regex display name defined by the business.
reExprs[*].enable boolean An explicit boolean is recommended; if omitted, it is treated as disabled. Disabled regexes must still be syntactically valid.
Example: true
How to obtain or fill in: true when it needs to be applied; false when it is stored but not applied.
reExprs[*].reExpr string A non-empty regex is recommended. Currently, an omitted 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 actual sensitive content pattern; when using a JSON string, backslashes must be doubled.
name string Optional. When omitted/empty, the system attempts to generate a name based on the display name of the calling identity and the current Unix seconds. Modification also regenerates it and does not keep the old name. Maximum 64 count units (ASCII/half-width katakana 1, other characters 2); both enabled and disabled rules of the same type participate in duplicate name checks.
Allows null: False
Allows empty string: False
Maximum length: 64
Example: production_only
How to obtain or fill in: Named by the business; first check existing names of the same type in the Log Access Rule List.
desc string Optional, up to 256 of the same count units. If omitted/empty, it is cleared to empty; modification does not preserve the original value.
Allows null: False
Allows empty string: True
Maximum length: 256
Example: 仅允许查看生产环境数据。
How to obtain or fill in: The business fills in the rule purpose and applicable objects.
indexes array Y Array of Log Index identifiers; required in this module. ["*"] means all available Log Indexes, and * is recommended to be used alone; [] does not mean all. For regular indexes, use the UUID, not the name; saving a rule does not create workspace or site authorization.
Allows null: False
Example: ["default"]
How to obtain or fill in: Obtain the UUID from the Log Index List; use default for the default index. For cross-workspace use, use the authorized source workspace UUID:index UUID.
roleUUIDs array Y Required array of role UUIDs. ["*"] means all roles, and [] matches no roles; Owner is still not subject to data access restrictions. Regular UUIDs are validated for existence within the scope, but the role status is not guaranteed to be 0, and base query permissions must still be granted separately.
Allows null: False
Example: ["role_example"]
How to obtain or fill in: Obtain role UUIDs in the current workspace from the Role List; use the Workspace Member List to verify the actual roles of members.
conditions string Y Required log filter expression; it is not the entire query or the outer braces. It is recommended not to exceed 4048 characters. The current logging path does not fully parse according to keyevent's E query rules, 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: Construct the DQL filter condition from the actual tags/fields of the target data; first verify it with a query from the same source.
extend json Optional arbitrary JSON for display; defaults to {}. There are no uniformly required subkeys or units, 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 as needed by its own editor; use {} when not needed.
logic string Compatibility display field, usually and/or. It is declared as required for creation and can be omitted for modification. If omitted, an empty string is saved; the effective filter uses conditions directly, changing logic does not rewrite the conditions, and merging of multiple roles/rules is not controlled by this field.
Allows null: False
Example: and
How to obtain or fill in: Keep it consistent with the condition combination method in the client filter editor.
maskFields string Optional. If omitted, an empty string is saved and no field masking is configured for this rule; omitting it on modification clears it. When fields are selected and reExprs=[], non-null values are masked entirely as ***; when a non-empty regex list is provided, only enabled regexes are applied, and disabling all is not equivalent to whole-field masking. It is recommended to use ≤256 characters to fit the storage column.
Allows null: False
Allows empty string: True
Example: message
How to obtain or fill in: Select from the actual field names in the query results. Separate multiple fields with 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; defaults to []. Modification replaces it as a whole. During saving, each regex is validated, including items with enable=false; an invalid regex returns ft.ErrorRegularExpression. Do not use a lone * to represent any string; use .*. When selected fields have no regex, the whole field is ***; regexes process only matching fragments in string content and replace the matched content with ***. Save-time validation differs from the execution engine, so after a successful save, still verify with representative queries.
Allows null: False
Example: [{"name": "token", "enable": true, "reExpr": "tkn_[0-9A-Za-z]+"}]
How to obtain or fill in: 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

Data Description.*

1. Role Authorization Access Notes 1. The specified roles can query only data within the specified query scope. 2. If a user has multiple roles and any of the user's roles is not in the roles of this rule, this data access rule does not take effect for that user, meaning the query scope is not restricted. 3. Multiple log data access rules in a workspace are combined with an OR relationship.

2. Request Parameter Description

Parameter Name type Required Description
name string Y Name
desc String N Description
indexes array Y Log Index information. For an index authorization outside the current workspace (which must be authorized by workspace), 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 for the data scope actually used, 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 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"}]

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]+"}]}'

Response

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; use uuid for calls.
content.uuid string lqrl_ rule UUID; the two 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; reads in this module include only non-deleted records.
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 not updated.
content.deleteAt integer Deletion time in Unix seconds; -1 if not deleted.
content.name string Saved value: Optional. When omitted/empty, the system attempts to generate a name based on the display name of the calling identity and the current Unix seconds. Modification also regenerates it and does not keep the old name. Maximum 64 count 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, up to 256 of the same count units. If omitted/empty, it is cleared to empty; modification does not preserve the original value.
content.indexes array Currently saved array of Log Index identifiers. ["*"] means all available Log Indexes; it is still subject to the actual source authorization.
content.indexes[] string Saved value: Array members should be non-empty strings; the original declaration does not enforce this per item, and an incorrect type can cause a 500.
content.roleUUIDs array Currently saved array of applicable role UUIDs. ["*"] means all roles, and [] matches no roles; base permissions must still be granted independently.
content.roleUUIDs[] string Saved value: Use a valid role; 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 for display; defaults to {}. There are no uniformly required subkeys or units, 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; not an additional effective condition.
content.logic string Saved value: Compatibility display field, usually and/or. It is declared as required for creation and can be omitted for modification. If omitted, an empty string is saved; the effective filter uses conditions directly, changing logic does not rewrite the conditions, and merging of multiple roles/rules is not controlled by this field.
content.maskFields string Saved value: Optional. If omitted, an empty string is saved and no field masking is configured for this rule; omitting it on modification clears it. When fields are selected and reExprs=[], non-null values are masked entirely as ***; when a non-empty regex list is provided, only enabled regexes are applied, and disabling all is not equivalent to whole-field masking. It is recommended to use ≤256 characters to fit the storage column.
content.reExprs array Saved value: Optional; defaults to []. Modification replaces it as a whole. During saving, each regex is validated, including items with enable=false; an invalid regex returns ft.ErrorRegularExpression. Do not use a lone * to represent any string; use .*. When selected fields have no regex, the whole field is ***; regexes process only matching fragments in string content and replace the matched content with ***. Save-time validation differs from the execution engine, so 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 a non-object element can cause a 500.
content.reExprs[].name string Saved value: Optional display name; it is not used as the matching expression and can be omitted without affecting regex matching.
content.reExprs[].enable boolean Saved value: An explicit boolean is recommended; if omitted, it is treated as disabled. Disabled regexes must still be syntactically valid.
content.reExprs[].reExpr string Saved value: A non-empty regex is recommended. Currently, an omitted value is checked as an empty string; do not rely on the server to complete a valid expression.
content.sources array Compatibility entity field; for log-specific creation it is saved as an empty array, and modification does not assign a value but keeps 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 site code; a historical empty string is treated as the current site. It does not mean a source authorization was newly created.
content.declaration object or null Workspace common declaration attached to non-empty business objects; when not configured, it can be null or an empty object; 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 Handling Method
406 ft.ParameterValidationFailed 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 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 is found when reading or validating remote index/RUM application metadata Other node configuration not initialized Ask the administrator to check the source site configuration, accessible addresses, and valid cross-workspace authorization, then retry after fixing.
400 ft.NameRepeat A non-deleted rule with the same name of the same type 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 values and submit again; do not use a lone *.
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 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 regular index of the resolved current-site source workspace 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 sites, or the index site does not match the source site {} site index information is invalid Configure separately by site, and verify the source authorization and site of each Log Index.
500 ft.InternalServerError Array item shape does not match, a field exceeds the storage length, a downstream ordinary 5xx occurs, or the database or post-commit cache fails 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; provide traceId.
404 ft.NotFoundDataQueryRuleCfg The target rule does not exist or has been deleted in the current workspace, and the log entry point also restricts to logging The specified log query rule configuration was not found Obtain the UUID again from the correct module list.

Feedback

Is this page helpful?