Skip to content

Commit d59189b

Browse files
authored
docs(elixir): Add data-collected page (#13840)
This adds data-collected page that summarizes how the Elixir SDK gathers
1 parent a4857f7 commit d59189b

File tree

1 file changed

+176
-0
lines changed

1 file changed

+176
-0
lines changed
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
---
2+
title: Data Collected
3+
description: "See what data is collected by the Sentry SDK."
4+
sidebar_order: 1
5+
---
6+
7+
Sentry takes data privacy very seriously and has default settings in place that prioritize data safety, especially when it comes to personally identifiable information (PII) data. When you add the Sentry SDK to your application, you allow it to collect data and send it to Sentry during the runtime of your application.
8+
9+
The category types and amount of data collected vary, depending on the integrations you've enabled in the Sentry SDK. Here's a list of data categories the Sentry Elixir SDK collects:
10+
11+
## HTTP Headers
12+
13+
When using the Plug or Phoenix integrations, HTTP headers from requests are included in error reports with built-in filtering for security:
14+
15+
**Default Behavior:**
16+
17+
- Most request headers are included by default
18+
- Sensitive headers are automatically scrubbed, including:
19+
- `authorization`
20+
- `authentication`
21+
- `cookie`
22+
23+
**Configuration:**
24+
25+
```elixir
26+
# Custom header filtering
27+
config :sentry,
28+
header_scrubber: &MyApp.CustomHeaderScrubber.scrub/1
29+
```
30+
31+
## Cookies
32+
33+
**Default Behavior:**
34+
- **All cookies are scrubbed by default** for privacy protection
35+
- No cookie data is sent to Sentry unless explicitly configured
36+
37+
**Configuration:**
38+
39+
```elixir
40+
# Enable cookie collection with custom scrubbing
41+
config :sentry,
42+
cookie_scrubber: &MyApp.CustomCookieScrubber.scrub/1
43+
```
44+
45+
## Users' IP Address
46+
47+
**Default Behavior:**
48+
- Client IP addresses are collected from HTTP requests
49+
- Prioritizes `x-forwarded-for` header, falls back to `conn.remote_ip`
50+
51+
**Configuration:**
52+
53+
```elixir
54+
# Custom IP address extraction
55+
config :sentry,
56+
remote_address_reader: {MyModule, :get_ip_address}
57+
```
58+
59+
## Request URL
60+
61+
**Default Behavior:**
62+
- Full request URLs are always sent, including query strings
63+
- URLs may contain PII depending on your application's routing structure
64+
65+
**Configuration:**
66+
67+
```elixir
68+
# Custom URL scrubbing
69+
config :sentry,
70+
url_scrubber: &MyApp.UrlScrubber.scrub/1
71+
```
72+
73+
## Request Body
74+
75+
**Default Behavior:**
76+
- Request body parameters are included with automatic scrubbing
77+
- Sensitive parameters are filtered by default:
78+
- `password`
79+
- `passwd`
80+
- `secret`
81+
- Credit card numbers (detected via regex pattern)
82+
83+
**Configuration:**
84+
```elixir
85+
# Custom body parameter filtering
86+
config :sentry,
87+
body_scrubber: &MyApp.BodyScrubber.scrub/1
88+
```
89+
90+
## Source Context
91+
92+
**Default Behavior:**
93+
94+
- Source code context is **disabled by default**
95+
- Must be explicitly enabled and packaged
96+
97+
**Configuration:**
98+
99+
```elixir
100+
# Enable source code context
101+
config :sentry,
102+
enable_source_code_context: true,
103+
root_source_code_paths: [File.cwd!()],
104+
context_lines: 3 # Lines before/after error
105+
```
106+
107+
## Local Variables In Stack Trace
108+
109+
**Default Behavior:**
110+
- Local variables are not included in stack traces
111+
- Stack traces contain function names, function variables, modules, file paths, and line numbers only
112+
113+
**Note:** Unlike some other SDKs, the Elixir SDK does not currently support capturing local variables due to the nature of the Erlang VM.
114+
115+
## Logger Data
116+
117+
When using the Logger integration, additional data is collected:
118+
119+
**Log Metadata:**
120+
121+
- Configurable via the `:metadata` option
122+
- Can include specific keys or all available metadata
123+
124+
**Process Context:**
125+
126+
- Process ID (PID)
127+
- GenServer state and last message (for crashed GenServers)
128+
- Process crash reasons
129+
130+
**Configuration:**
131+
132+
```elixir
133+
config :logger, :sentry,
134+
metadata: [:request_id, :user_id] # Specific keys
135+
# or
136+
config :logger, :sentry,
137+
metadata: :all # All available metadata
138+
```
139+
140+
<Alert>
141+
There's always risk that PII will leak into Sentry via Logger integration. It is recommended to review your log metadata and scrub any sensitive information before logging.
142+
</Alert>
143+
144+
## Application Dependencies
145+
146+
**Default Behavior:**
147+
148+
- List of loaded applications and their versions are sent
149+
- Helps with debugging version-specific issues
150+
151+
**Configuration:**
152+
153+
```elixir
154+
# Disable dependency reporting
155+
config :sentry,
156+
report_deps: false
157+
```
158+
159+
## Oban Job Data
160+
161+
When using the Oban integration for background jobs:
162+
163+
**Job Information:**
164+
- Job arguments, attempt count, queue name
165+
- Worker class name
166+
- Job metadata and tags
167+
- Max attempts and current state
168+
169+
170+
## More information
171+
172+
To learn more about customizing PII data collection, see the following API docs:
173+
174+
- [Configuration](https://hexdocs.pm/sentry/10.10.0/Sentry.html#module-configuration)
175+
- [PlugContext](https://hexdocs.pm/sentry/Sentry.PlugContext.html)
176+
- [Logger Handler](https://hexdocs.pm/sentry/10.10.0/Sentry.LoggerHandler.html)

0 commit comments

Comments
 (0)