When your application sends error events to Sentry, the payloads can include request headers, form data, environment variables, and stack frame locals—any of which might contain passwords, credit card numbers, API keys, or other sensitive values. Data scrubbing lets you prevent that information from ever being stored in Sentry.Documentation Index
Fetch the complete documentation index at: https://sentrydocs.dev/llms.txt
Use this file to discover all available pages before exploring further.
How scrubbing works
Sentry applies scrubbing in two layers:- Server-side scrubbing — Sentry scrubs data after it’s received, before it’s stored. Rules here apply to all SDKs regardless of version.
- SDK-side scrubbing — Your SDK filters or modifies events before they’re sent at all. This is the safest option because the data never leaves your infrastructure.
Default scrubbing
Sentry’s default scrubbing automatically redacts values associated with common field names in all incoming events. Fields matched by these defaults include:password,passwd,secretapi_key,apikey,auth,credentials,token- Credit card numbers (pattern-matched)
- Social Security Numbers (pattern-matched)
Global scrubbing rules
Organization-level rules apply to every project. Use them for values that must never appear in Sentry regardless of which project captures them.Add sensitive fields
Under Additional Sensitive Fields, enter field names whose values should always be redacted. This matches field names anywhere in the event, including nested objects.Example:
ssn, credit_card, internal_api_tokenAdd safe fields
Under Safe Fields, enter field names that should never be scrubbed even if they match a default pattern. Use this when you have a field like
token_count that you need to keep.Project-level scrubbing
Project settings let you customize scrubbing for a single project without affecting others.- Go to Settings > [Project] > Security & Privacy.
- Configure Additional Sensitive Fields and Safe Fields for this project.
- Toggle Scrub IP Addresses to prevent user IP addresses from being stored.
Project-level fields are merged with organization-level fields. You cannot use project settings to un-scrub a field that the organization has marked as sensitive.
SDK-side scrubbing
The most reliable way to prevent sensitive data from reaching Sentry is to remove or mask it before the event is sent. Use thebeforeSend callback in your SDK initialization.
- JavaScript
- Python
Scrubbing request data
By default, Sentry does not capture raw HTTP request bodies, but it does capture request headers, query parameters, and cookies. To prevent a specific header or cookie from being stored:- Add it to Additional Sensitive Fields in your project’s Security & Privacy settings.
- Or use
beforeSendto delete the field fromevent.requestbefore sending.
Data retention
How long Sentry retains your events depends on your plan. Events are not kept indefinitely—after the retention window, they are permanently deleted. You can view and configure your retention period under Settings > Security & Privacy > Data Privacy.What happens when a value is scrubbed?
What happens when a value is scrubbed?
Scrubbed values are replaced with the string
[Filtered] in the event payload. The field name is preserved so you can see that data existed, but the value is permanently removed. Sentry does not store the original value anywhere.Does scrubbing apply to attachments?
Does scrubbing apply to attachments?
Server-side PII scrubbing does not apply to file attachments. If you send attachments that may contain sensitive data, remove the data from the attachment before sending it, or disable attachment sending for that project.
Can I test my scrubbing rules?
Can I test my scrubbing rules?
The Data Scrubbing Selector Suggestions tool in Settings > [Project] > Security & Privacy shows you which selectors match fields in recent events. This helps you verify that your rules target the right data before you commit to them.