Skip to content

Commit 7b57cdb

Browse files
committed
DOCS-680 - Update role filter article
1 parent e0a8edf commit 7b57cdb

File tree

3 files changed

+60
-31
lines changed

3 files changed

+60
-31
lines changed

docs/manage/users-roles/roles/construct-search-filter-for-role.md

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Construct a role search filter to control what log data users with
55
---
66

77
import useBaseUrl from '@docusaurus/useBaseUrl';
8-
8+
import RoleStacking from '../../../reuse/role-stacking-tip.md';
99

1010
This page describes how to define search filters for a role. These instructions apply to the **Search Filter** option in Step 6 of the [Create a role](/docs/manage/users-roles/roles/create-manage-roles/#create-a-role) procedure.
1111

@@ -25,23 +25,25 @@ When a user with this filter enters a query like:
2525
_sourceCategory=labs/apache | parse "* --" as src_ip | count by src_ip | sort _count
2626
```
2727

28-
Sumo silently (it’s transparent to the user) adds the role filter to the beginning of the query with an AND:
28+
Sumo Logic silently (it’s transparent to the user) adds the role filter to the beginning of the query with an `AND`:
2929

3030
```sql
3131
_sourceCategory=labs* AND (_sourceCategory=labs/apache | parse "* --" as src_ip | count by src_ip | sort _count)
3232
```
3333

34+
<!-- Hiding the following for work on DOCS-680
3435
The example above positively grants access to log data. You can do the opposite: explicitly deny access to data, with an exclamation point (!). For example:
3536
3637
```
3738
!_sourceCategory=JobX*
3839
```
3940
4041
The role filter above denies access to log data whose  `_sourceCategory` begins with “JobX”. (Access to log data with other source category values is not restricted.)
42+
-->
4143

4244
The examples above are simple: they involve a single role, and hence a single role filter. 
4345

44-
Typically however, a Sumo user will have multiple roles. If a user has multiple roles, Sumo `OR`s the several role filters and prepends that expression to the user’s queries with an `AND`, as discussed in [Multiple role filters and filter precedence](#multiple-role-filters-and-filter-precedence).
46+
Typically however, a Sumo Logic user will have multiple roles. If a user has multiple roles, Sumo Logic `OR`s the several role filters and prepends that expression to the user’s queries with an `AND`, as discussed in [Multiple role filters and filter precedence](#multiple-role-filters-and-filter-precedence).
4547

4648
## Search filter basics
4749

@@ -69,33 +71,33 @@ You can use metadata fields in a role search filter. The following search filter
6971
_collector=HR_Tools
7072
```
7173

72-
When a user with that role filter runs a query, Sumo prepends the filter to the query with an AND:
74+
When a user with that role filter runs a query, Sumo Logic prepends the filter to the query with an `AND`:
7375

7476
```sql
7577
_collector=HR_Tools AND <user-query>
7678
```
7779

7880
### Using AND and OR in a search filter
7981

80-
You can use AND and OR in a search filter. For example, this role filter uses OR to grant access to log data from two source categories:
82+
You can use `AND` and `OR` in a search filter. For example, this role filter uses `OR` to grant access to log data from two source categories:
8183

8284
```sql
8385
_sourceCategory=stock OR _sourceCategory=insurance
8486
```
8587

86-
When a user with that role filter runs a query, Sumo prepends the filter to the query with an AND:
88+
When a user with that role filter runs a query, Sumo Logic prepends the filter to the query with an `AND`:
8789

8890
```sql
8991
(_sourceCategory=stock OR _sourceCategory=insurance) AND <user-query>
9092
```
9193

92-
This role filter below uses AND to grant access to log data with the source category “insurance” from the collector named “HR_Tools”:
94+
This role filter below uses `AND` to grant access to log data with the source category “insurance” from the collector named “HR_Tools”:
9395

9496
```sql
9597
_collector=HR_Tools AND _sourceCategory=insurance
9698
```
9799

98-
When a user with that role filter runs a query, Sumo prepends the filter to the query with an AND:
100+
When a user with that role filter runs a query, Sumo Logic prepends the filter to the query with an `AND`:
99101

100102
```sql
101103
(_collector=HR_Tools AND _sourceCategory=insurance) AND <user-query>
@@ -109,7 +111,7 @@ You can include a string you want to search for in a role search filter. This ro
109111
_collector=HR_Tools AND enrollment
110112
```
111113

112-
When a user with that role filter runs a query, Sumo runs it like this:
114+
When a user with that role filter runs a query, Sumo Logic runs it like this:
113115

114116
```sql
115117
(_collector=HR_Tools AND enrollment) AND <user-query>
@@ -123,7 +125,7 @@ You can use an asterisk (\*) as a wildcard in a role search filter. This role fi
123125
_collector=HR* 
124126
```
125127

126-
When a user with that role filter runs a query, Sumo runs it like this:
128+
When a user with that role filter runs a query, Sumo Logic runs it like this:
127129

128130
```sql
129131
_collector=HR* AND <user-query>
@@ -135,7 +137,7 @@ This role filter grants access to logs that contain the string “violation” f
135137
_collector=HR* AND violation
136138
```
137139

138-
When a user with that role filter runs a query, Sumo runs it like this:
140+
When a user with that role filter runs a query, Sumo Logic runs it like this:
139141

140142
```sql
141143
(_collector=HR* AND violation) AND <user-query>
@@ -155,15 +157,21 @@ denies access to log data whose:  
155157
* `_sourceName` contains “finance”
156158
* `_sourceCategory` contains “secret”
157159

158-
When a user with that role filter runs a query, Sumo runs it like this:
160+
When a user with that role filter runs a query, Sumo Logic runs it like this:
159161

160162
```sql
161163
(!_sourceHost=humanresources* AND !_sourceName=*finance* AND !_sourceCategory=*secret*) AND <your-query>
162164
```
163165

166+
:::warning
167+
Although we provide this an example to show that it's possible, we do not recommend filtering to deny access. That's because if multiple roles are applied to a user, a situation can arise where one role denies access to a certain area, but another role allows access to that same area. Therefore, if possible, always apply filtering that allows access rather than denies access. Then roles can be used in an additive way to build access for users.
168+
:::
169+
164170
## Multiple role filters and filter precedence
165171

166-
When a user is assigned to multiple Sumo roles, Sumo combines the role filters from each of the roles using a logical OR to come up with the combined role filter.
172+
When a user is assigned to multiple Sumo Logic roles ("role stacking"), Sumo Logic combines the role filters from each of the roles using a logical `OR` to come up with the combined role filter.
173+
174+
<RoleStacking/>
167175

168176
When multiple roles filters are applied to a query, the least restrictive filter takes precedence. That this rule doesn’t apply if any of the role filters applied to a query is simply blank, which effectively grants access to all data, and would be the least restrictive filter. If the combined search filters applied to a query includes filters that are blank, the blank search filter is ignored and the next least restrictive filter takes precedence. So, if you actually want to grant a role access to all data, set the search filter to an asterisk (`*`). A search filter that is configured in that fashion will take precedence when combined with more restrictive search filters.
169177

@@ -180,7 +188,7 @@ Role A allows access to log data whose `_source` tag is “GCP Audit” and `_co
180188

181189
Role B Allows access to log data whose `_sourceCategory` tag begins with “Vx”.  
182190

183-
When a user with Roles A and B runs a query, Sumo applies the filters with an OR, and prepends them with an AND to your query, like this:
191+
When a user with Roles A and B runs a query, Sumo Logic applies the filters with an `OR`, and prepends them with an `AND` to your query, like this:
184192

185193
```sql
186194
((_source="GCP Audit" AND _collector="GCP") OR _sourceCategory="Vx*")
@@ -196,19 +204,19 @@ Assume the following role filters.
196204
| Role | Filter |
197205
|:----------|:-------------------|
198206
| Role A | `_collector=fee*` |
199-
| Role B | `!_collector=fi*` |
207+
| Role B | `_collector=f*` |
200208

201209
Role A allows access only to log data whose `_collector` tag matches “fee\*”, and not to data whose `_collector` tag is any other value.
202210

203-
Role B Allows access to any log data whose `_collector` tag does not match “fi”.  
211+
Role B Allows access to any log data whose `_collector` tag matches “f\*”, and not to data whose `_collector` tag is any other value.  
204212

205-
When a user with Roles A and B runs a query, Sumo combines the two filters with an OR, and prepends them with an AND to your query, like this:
213+
When a user with Roles A and B runs a query, Sumo Logic combines the two filters with an `OR`, and prepends them with an `AND` to your query, like this:
206214

207215
```sql
208-
(_collector=fee OR !_collector=fi) AND <your-query>
216+
(_collector=fee OR _collector=f) AND <your-query>
209217
```
210218

211-
**The least restrictive of the role filters takes precedence**. So, although Role A effectively restricts results to log data that matches `_collector=fee*`, Role B allows grants access to all collectors, except for those that match `_collector=fi*`. So, Role B takes precedence and Role A has no effect.
219+
**The least restrictive of the role filters takes precedence**. So, although Role A effectively restricts results to log data that matches `_collector=fee*`, Role B allows grants access to all collectors that match `_collector=f*`. So, Role B takes precedence and Role A has no effect.
212220

213221
### Example 3 
214222

@@ -224,14 +232,15 @@ Role A allows access only to log data whose `_sourceCategory` is “analytics-la
224232

225233
Role B Allows access to log data whose `_sourceCategory` begins with “analytics”.
226234

227-
When a user with Roles A and B runs a query, Sumo combines the two filters with an OR, like this:
235+
When a user with Roles A and B runs a query, Sumo Logic combines the two filters with an `OR`, like this:
228236

229237
```sql
230238
(_sourceCategory=analytics-lab OR _sourceCategory=analytics*) AND <your-query>
231239
```
232240

233241
**The least restrictive of the role filters takes precedence.** Role A alone grants access to a log data from a single  source category, “analytics-lab”.  Role B grants access to log data to any source category that starts with “analytics”. Since the least restrictive filter takes precedence, data tagged `_sourceCategory=analyticsLong` could be returned in addition to data tagged `_sourceCategory=analytics-lab`.
234242

243+
<!-- Hiding the following for work on DOCS-680
235244
### Example 4
236245
237246
Assume the following role filters.
@@ -245,15 +254,16 @@ Role A allows access to log data whose `_collector` tag matches “prod\*”, an
245254
246255
Role B prevents access to log data whose `_sourceCategory` tag does contain “shoguns”. Data with any ` _sourceCategory` tag that does not contain “shoguns” is available. 
247256
248-
When a user with Roles A and B runs a query, Sumo combines the two filters with an OR, and prepends them with an AND to your query, like this:
257+
When a user with Roles A and B runs a query, Sumo Logic combines the two filters with an `OR`, and prepends them with an `AND` to your query, like this:
249258
250259
```sql
251260
(_collector=prod* OR !_sourceCategory=*shoguns*) AND <your-query>
252261
```
253262
254263
Role B is the least restrictive. Users with the combined role filter will be able to view any log data whose  `_sourceCategory` does not contain the string “shoguns”, regardless of the value of the `_collector` tag.
264+
-->
255265

256-
### Example 5
266+
### Example 4
257267

258268
Assume the following role filters.
259269

@@ -266,4 +276,8 @@ Role A allows access to all indexes whose name starts with "sumologic".
266276

267277
Role B, with a blank search filter (user did not enter anything as the search filter for the role), allows access to all data.
268278

269-
When a user with Roles A and B runs a query, Sumo combines the two filters and since Role B has a blank search filter, the more restrictive search filter, Role A, takes precedence. Users with the combined role filter will be able to  view any log data in any of the indexes prefixed with "sumologic".
279+
When a user with Roles A and B runs a query, Sumo Logic combines the two filters and since Role B has a blank search filter, the more restrictive search filter, Role A, takes precedence. Users with the combined role filter will be able to  view any log data in any of the indexes prefixed with "sumologic".
280+
281+
## Test role filtering
282+
283+
To test whether filtering works as expected, select a role and click the **Emulate log search** button. For more information, see [Test a role](/docs/manage/users-roles/roles/create-manage-roles/#test-a-roles-log-access-rights).

0 commit comments

Comments
 (0)