How do I keep passwords and personal data out of error reports and logs?

Keep it out of messages, send sensitive values as named fields, and remove the rest in the browser with beforeSend for errors and beforeSendLog for log lines. Monitoring drops request bodies, headers, cookies, user data and IP addresses, and redacts emails, tokens and card numbers in text. Free text is not guaranteed secret-free.

Last updated 26 November 2026. By Paul Badarau.

Bea, a fictional developer, builds the booking form for a physiotherapy clinic. A failed booking throws Booking failed for Maria Costa, 12 Rua Nova, card 4111 1111 1111 1111. Monitoring stores that message as Booking failed for Maria Costa, 12 Rua Nova, card [card]. The card number matched a pattern. The name and the street did not, and they are now in the issue title.

Monitoring removes a lot before anything is stored. Error events lose request bodies, headers, cookies, user data, IP addresses and the query values of URLs. Log lines lose attributes named user. or client. and header and body attributes. Values under names such as password, token, secret, authorization, cookie, session, API key, email or phone are replaced with [Filtered]. In text, bearer and basic credentials, JWTs, passwords in URLs, key=value secrets, email addresses, IP addresses and card numbers that pass the Luhn check are replaced.

The rest is up to the code that sends it:

  1. Write messages without personal data. Booking failed with the booking number as a tag tells Bea as much as the name did.
  2. Send sensitive values as named fields, such as { email: value }, so the name decides that they are filtered.
  3. Scrub errors in beforeSend in Sentry.init: change or remove what you know is private in the event, and return it.
  4. Scrub log lines in beforeSendLog, for example beforeSendLog(log) { delete log.attributes?.patientName; return log; }. Returning null drops the line.
  5. Drop breadcrumbs that print form data in beforeBreadcrumb, for example any with the console category.

The path of a URL is kept as sent. A reset link like /reset/8f3a9c2e71 keeps its token in the request URL and in breadcrumbs, even though query values are removed, so rewrite such paths in beforeSend and beforeBreadcrumb. Issue titles also go into the new-issue email to Owners and Administrators, after the same redaction, so a name in an error message also lands in their inboxes. Events are kept for 7 days and issue summaries for 30 days after the last event.

The product page for this is Monitoring.

Start your 14-day free trial