You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also remove some useless value types that I might want to remove: booleans are never stripped, ever, and the event value type does not work at the moment.
Copy file name to clipboardExpand all lines: src/collections/_documentation/data-management/advanced-datascrubbing.md
+70-26Lines changed: 70 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -62,17 +62,60 @@ Rules generally consist of three parts:
62
62
-_MAC Addresses_
63
63
-_Anything_: Matches any value. This is useful if you want to remove a certain JSON key by path using [_Selectors_](#selectors) regardless of the value.
64
64
65
+
{% capture __alert_content -%}
66
+
67
+
Sentry does not know if a local variable that looks like a credit card number actually is one. As such, you need to expect not only false-positives but also false-negatives. [_Selectors_](#selectors) can help you in limiting the scope in which your rule runs.
68
+
69
+
{%- endcapture -%}
70
+
{%- include components/alert.html
71
+
title="Sentry does not know what your code does"
72
+
content=__alert_content
73
+
level="warning"
74
+
%}
75
+
76
+
65
77
## Selectors
66
78
67
-
You can select a region of the event using JSON-path-like syntax. As an example, to delete a specific key in "Additional Data", you would configure:
79
+
Selectors allow you to restrict rules to certain parts of the event. This is useful to unconditionally remove certain data by variable/field name from the event, but can also be used to conservatively test rules on real data.
80
+
81
+
Data scrubbing always works on the raw event payload. Keep in mind that some fields in the UI may be called differently in the JSON schema. When looking at an event there should always be a link called "JSON" present that allows you to see what the data scrubber sees.
82
+
83
+
For example, what is called "Additional Data" in the UI is called `extra` in the event payload. To remove a specific key called `foo`, you would write:
84
+
85
+
```
86
+
[Remove] [Anything] from [extra.foo]
87
+
```
88
+
89
+
Another example. Sentry knows about two kinds of error messages: the exception message, and the top-level log message. Here is an example of how such an event payload as sent by the SDK (and downloadable from the UI) would look like:
90
+
91
+
```json
92
+
{
93
+
"logentry": {
94
+
"formatted": "Failed to roll out the dinglebop"
95
+
},
96
+
"exception": {
97
+
"values": [
98
+
{
99
+
"type": "ZeroDivisionError",
100
+
"value": "integer division or modulo by zero",
101
+
}
102
+
]
103
+
}
104
+
}
105
+
```
106
+
107
+
Since the "error message" is taken from the `exception`'s `value`, and the "message" is taken from `logentry`, we would have to write the following to remove both from the event:
68
108
69
-
> `Remove``Anything` from `extra.foo`
109
+
```
110
+
[Remove] [Anything] from [exception.value]
111
+
[Remove] [Anything] from [logentry.formatted]
112
+
```
70
113
71
114
### Boolean Logic
72
115
73
116
You can combine selectors using boolean logic.
74
117
75
-
* Prefix with `!` to invert the selector. `foo` matches the JSON key `foo`, while `(~foo)` matches everything but `foo`.
118
+
* Prefix with `!` to invert the selector. `foo` matches the JSON key `foo`, while `!foo` matches everything but `foo`.
76
119
* Build the conjunction (AND) using `&&`, such as: `foo && !extra.foo` to match the key `foo` except when inside of `extra`.
77
120
* Build the disjunction (OR) using `||`, such as: `foo || bar` to match `foo` or `bar`.
78
121
@@ -83,32 +126,33 @@ You can combine selectors using boolean logic.
83
126
84
127
### Value Types
85
128
86
-
Select subsections by JSON-type or semantic meaning using the following:
87
-
88
-
*`$string`
89
-
*`$number`
90
-
*`$boolean`
91
-
*`$datetime`
92
-
*`$array`
93
-
*`$object`
94
-
*`$event`
95
-
*`$exception`
96
-
*`$stacktrace`
97
-
*`$frame`
98
-
*`$request`
99
-
*`$user`
100
-
*`$logentry` (also applies to `event.message`)
101
-
*`$thread`
102
-
*`$breadcrumb`
103
-
*`$span`
104
-
*`$sdk`
105
-
106
-
Examples:
129
+
Select subsections by JSON-type using the following:
130
+
131
+
*`$string` matches any string value
132
+
*`$number` matches any integer or float value
133
+
*`$datetime` matches any field in the event that represents a timestamp
134
+
*`$array` matches any JSON array value
135
+
*`$object` matches any JSON object
136
+
137
+
Select known parts of the schema using the following:
138
+
139
+
*`$exception` matches a single exception instance in `{"exception": {"values": [...]}}`
140
+
*`$stacktrace` matches a stack trace instance
141
+
*`$frame` matches a frame
142
+
*`$request` matches the HTTP request context of an event
143
+
*`$user` matches the user context of an event
144
+
*`$logentry` matches both the `logentry` attribute of an event as well as the `message` attribute
145
+
*`$thread` matches a single thread instance in `{"threads": {"values": [...]}}`
146
+
*`$breadcrumb` matches a single breadcrumb in `{"breadcrumbs": {"values": [...]}}`
147
+
*`$span` matches a [trace span]({% link _documentation/performance/performance-glossary.md %}#span)
148
+
*`$sdk` matches the SDK context in `{"sdk": ...}`
149
+
150
+
#### Examples
107
151
108
152
* Delete `event.user`:
109
153
110
154
```
111
-
[Remove] [Anything] from [event.user]
155
+
[Remove] [Anything] from [$user]
112
156
```
113
157
114
158
* Delete all frame-local variables:
@@ -117,7 +161,7 @@ Examples:
117
161
[Remove] [Anything] from [$frame.vars]
118
162
```
119
163
120
-
### Escaping Specal Characters
164
+
### Escaping Special Characters
121
165
122
166
If the object key you want to match contains whitespace or special characters, you can use quotes to escape it:
0 commit comments