Data Access¶
Data Access is used to restrict the visibility of data such as logs, RUM, APM, metrics, and events by member role, and to protect sensitive information through field masking or regular expressions.
Before configuring, distinguish the following three types of permissions and rules:
- Role query permissions: Determine whether members can query the corresponding type of data. See Permission List.
- Data Access Scope: On the basis of members' existing query permissions, limits the data that can be viewed by data type, index, service, application, metric, event source, and filter conditions.
- Masking configuration: Masks sensitive fields in returned data or content that matches regular expressions.
Associating Data Access rules with a role does not grant the role data query permissions that it does not already have. How data scope and masking take effect must also be determined in conjunction with Role Scenarios and Query Permissions.
On the Manage > Data Access page, you can start creating a new rule in either of the following ways:
Click the Create button in the upper left of the page to start creating a rule.
If historical access rules exist on the current page, click the icon under the operations on the right side of the rule to clone an existing rule and then create a new one.
Configure¶
- Select a data type. Supported types are logs, APM, RUM, metrics, and events.
- Define the name of the current rule.
- Enter the description of the current rule.
- Select the Workspace site to which the current rule applies.
-
For the data type you selected, select the corresponding index, service, application, metric, or event source.
-
Define the access scope of data under the current rule.
-
Add one or more fields that need to be masked.
-
Use regular expressions to mask sensitive information in field content.
-
Select one or more member roles to which the current access rule can be applied, including default roles in the system and custom roles.
- Save.
Configuration Notes¶
Data Access Scope Definition¶
Data scope defines the data that the current rule allows users to view. When this rule is in effect, returned results must meet its filter conditions. When multiple roles or multiple rules are associated at the same time, the final visible scope must also be determined in conjunction with the permission merging method below.
Filtering can be configured by tag/attribute, including positive filtering, negative filtering, fuzzy matching, negative fuzzy matching, exists, and does not exist.
By default, All (AND) is used between different fields; you can also switch to Any (OR):
| Logical relationship | Matching method | Example |
|---|---|---|
| All (AND), default | All field filter conditions are met simultaneously | host = [host1, host2] AND service = [service1, service2] |
| Any (OR) | Any field filter condition is met | host = [host1, host2] OR service = [service1, service2] |
In the above example, host = [host1, host2] means that host is either host1 or host2. The AND/OR settings within a single rule and the merging relationship between multiple rules must be determined separately.
Regular Expression Masking¶
When setting access rules, even if the data scope has been defined, additional measures are still needed to prevent sensitive or unnecessary information from being disclosed. In this case, you can use masked fields or regular expressions to further process data and strengthen data protection.
On the configuration page, in addition to directly adding individual masked fields, if you need to further mask part of the content in the log message, for example, to hide token or IP information, you can add regular expressions to meet this requirement.
- Multiple regular expressions can be configured, with a maximum of 10 expressions under one access rule.
- You can disable or enable a regular expression. Subsequent application and preview apply masking only according to enabled regular expressions.
- You can edit or delete a regular expression directly here.
- You can drag to reorder regular expressions. When data matches this masking rule, regular expressions are applied from top to bottom for masking.
- You can create a regular expression directly here:
In the dialog box that appears, enter the required information.
If Apply to Rule is selected, the rule is added directly below the regular expression.
Role Scenarios and Query Permissions¶
Simple Case¶
Assume that a member has only one role, such as Read-only. After the rule is applied to this role, the member's query scope is limited by the rule and masking is performed on the basis of existing data query permissions.
If "All" is selected for applicable roles, the rule applies to all roles except Owner, including Administrator.
How the rule takes effect for different roles is as follows:
| Role-rule association | How the Data Access rule takes effect |
|---|---|
| Owner | Not restricted by Data Access rules. |
| Administrator with associated rules | Data scope is limited and masking is performed according to the associated rules. |
| Administrator without associated rules | Can still query data within the original permission scope and is not affected by the Data Access Scope Limit switch. |
| Other members matched by rules | Provided they have the corresponding data query permissions, data scope is limited and masking is performed according to the rules. |
| Other members not matching any rule | Whether they are allowed to view the data corresponding to the rules depends on the Data Access Scope Limit switch. When enabled, such members cannot view the data corresponding to the rules. |
Within the data scope limited by the effective rules, members can continue to add query filter conditions; queries beyond the visible scope return no data.
Multi-Role Permission Coverage¶
When the same member has multiple roles, the final viewable data scope is the union of the viewable scopes of all roles.
Therefore, to determine a member's actual visible scope, you need to check all roles of the member and their associated rules at the same time; you cannot draw a conclusion based on only one of the rules.
Multi-Rule Permission Control¶
A single role can be associated with multiple Data Access rules. During configuration, determine the following two merging relationships separately:
- Within a single rule: Different fields are combined according to the "All (AND)" or "Any (OR)" selected for the rule; AND is used by default.
- Between multiple rules: Data scopes are merged by OR, meaning that members can view data allowed by any rule.
For example, both Rule 1 and Rule 2 use "All (AND)":
- Rule 1:
host = [主机1, 主机2] AND service = [服务1, 服务2]; - Rule 2:
host = [主机3, 主机4] AND source = [来源1, 来源2].
After the same role is associated with the above two rules, the visible data scope is:
(host = [主机1, 主机2] AND service = [服务1, 服务2])OR(host = [主机3, 主机4] AND source = [来源1, 来源2])
Data Scope Merging and Masking
Data scopes are merged by union, and the masking configuration is still applied to returned data. When the same role is associated with multiple rules, if masking is configured in one of the rules, the data returned by all associated rules is affected by that masking configuration.
Maintain Associations in Role Management¶
In addition to selecting applicable roles in a Data Access rule, you can also view and maintain the Data Access rules associated with a role in a centralized manner in Manage > Role Management.
- The Data Access Rules column in the role list shows the number of rules associated with the current role.
- After clicking or hovering over the number, you can search for and select rules with pagination in the right-side drawer and save the association, or jump to the Data Access page to continue configuring.
- This entry only maintains the association between roles and rules. It does not modify the rule's data scope, filter conditions, data type, or masking configuration.
- After the rule is saved successfully, the associated count in the role list is updated synchronously.
Viewing and editing this association are controlled by the Role View, Data Access View, and Data Access Management permissions, respectively. For details, see Role Management.
Configuration Example¶
- Select the index
rp70in the current Workspace. - Select All (AND) for the data scope, and add two filter conditions:
host:cn-hangzhou.172.**.**andservice:kodo. - Do not set masked fields here. Add the regular expression
tkn_[\da-z]*to mask the matchingtokencontent. - Associate the current rule with the
Read-onlyrole in the Workspace. - Click Save. If needed, click Preview in the lower left to view the masking effect.
With this rule, Read-only members can view data in log index rp70 that meets both the above host and service conditions, and the token content matching the regular expression is masked according to the configuration.
If the member also has other roles, or the role is associated with other Data Access rules, the final visible scope must be determined in conjunction with the merging method for multiple roles and multiple rules.
Use Cases¶
Based on Data Access rules that are already in effect, snapshot data received by members matched by the rules is automatically filtered according to their permission rules. Even if the data contained in a snapshot exceeds the member's access permissions, the system filters it first, and ultimately members can only view data that complies with their access rules.
Management List¶
- You can view information such as the index associated with a rule, query conditions, whether masking is enabled, the number of associated roles, and the number of members. You can also view and maintain associated rules by role in Role Management.
- Show only rules related to me: Off by default, showing all rules; when enabled, only rules related to the current role are shown.
- Enable/disable rule: When enabled, the rule participates in data scope limits and masking; when disabled, the rule no longer takes effect. The data that members can actually view still needs to be determined in conjunction with role permissions, other effective rules, and the Data Access Scope Limit setting.
- Edit: Modify the rule name, description, bound index, filter conditions, and authorized roles.
- Clone: Quickly copy the current rule.
- Operation Audit: Records operations related to the rule.
- Delete: Delete the current rule.
- Batch Operations: Supports enabling, disabling, and deleting multiple rules in batches.





