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 configuration, distinguish the following three types of permissions and rules:
- Role query permissions: Determine whether members can query the corresponding type of data. For details, see Permission List.
- Data access scope: On the basis of members' existing query permissions, limits the data they can view by data type, index, service, application, metric, event source, and filter conditions.
- Masking configuration: Masks sensitive fields in returned data or content matching regular expressions.
Associating a data access rule 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 corner of the page to start creating a rule;
If existing access rules are present on the current page, click the icon under the actions on the right side of a rule to clone the existing rule and then create a new one.
Configure¶
- Select a data type. Supported types are logs, APM, RUM, metrics, and events;
- Define a name for the current rule;
- Enter a description for the current rule;
- Select the workspace site to which the current rule applies;
-
For the selected data type, select the corresponding index, service, application, metric, or event source;
-
Define the data access scope under the current rule;
-
Add one or more fields 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 applies, 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 viewing. When the rule is in effect, returned results must meet its filter conditions. If 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.
Filters 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 across different fields; you can also switch to Any (OR):
| Logical Relationship | Matching Method | Example |
|---|---|---|
| All (AND), default | Meets the filter conditions of all fields simultaneously | host = [host1, host2] AND service = [service1, service2] |
| Any (OR) | Meets the filter condition of any field | host = [host1, host2] OR service = [service1, service2] |
In the examples above, host = [host1, host2] means that host is host1 or host2. The AND/OR setting within a single rule and the merging relationship between multiple rules must be evaluated separately.
Regular Expression Masking¶
When setting an access rule, even if the data scope has been defined, additional measures are still needed to prevent the leakage of sensitive or unnecessary information. In this case, masked fields or regular expressions can be used to further process data to 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 a regular expression 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 move the position of 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 that appears, enter the required information.
If Apply to Rule is selected, this rule is added directly below the regular expression.
Role Scenarios and Query Permissions¶
Simple Case¶
Assume a member has only one role, such as Read-only. After the rule is applied to that role, the member's query scope is limited by the rule and masking is performed, on the basis of the member's existing data query permissions.
If "All" is selected for applicable roles, the rule applies to all roles except Owner, including Administrator.
The rule takes effect for different roles as follows:
| Role-Rule Association | How the Data Access Rule Takes Effect |
|---|---|
| Owner | Not restricted by data access rules. |
| Administrator with associated rules | Limits the data scope and performs masking 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 that they have the corresponding data query permissions, limits the data scope and performs masking according to the rules. |
| Other members not matched by 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 defined by 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 data scope they can view is the union of the scopes visible to each role.
Therefore, when determining a member's actual visible scope, you must check all of the member's roles and their associated rules together; you cannot draw a conclusion based only on one of the rules.
Multi-rule Permission Control¶
A single role can be associated with multiple data access rules. During configuration, evaluate the following two types of merging relationships separately:
- Within a single rule: Different fields are combined according to "All (AND)" or "Any (OR)" selected for the rule; AND is used by default.
- Between multiple rules: Data scopes are merged with OR, meaning members can view data allowed by any rule.
For example, Rule 1 and Rule 2 both 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 masking configurations still apply to returned data. When the same role is associated with multiple rules, if masking is configured for one of the rules, 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 roles in a unified 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 configuration;
- 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 accordingly.
Viewing and editing this association are controlled by Role View, Data Access View, and Data Access Management permissions, respectively. For details, see Role Management.
Configuration Example¶
- Select the index
rp70in this workspace; - Select All (AND) for 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 matchingtokencontent; - Associate the current rule with the
Read-onlyrole in the workspace; - Click Save. If needed, click Preview in the lower left corner to view the masking effect.
With this rule, members with the Read-only role can view data under the Log Index rp70 that meets both the host and service conditions above, and token content matching the regular expression is masked as configured.
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 How Multiple Roles and Multiple Rules Are Merged.
Use Cases¶
Based on effective data access rules, 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, so members can ultimately view only 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: The default is "Off", 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 restriction 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.





