Skip to content

Privacy

Consent decides whether a record is collected; the privacy rules decide what is in it. They run before a record is queued - in the browser script and in the .NET pipeline alike - so secrets in URLs, e-mail addresses in error messages and card numbers in logs are gone before anything leaves the device or the process. The defaults are on; most apps only ever add to them.

See it happen

Each button below makes a real request, throws a real error, or records a real event or log, carrying something that must not be recorded. Open a record in the feed to see what was actually exported: the server received the original URL, the telemetry did not. The first four go through the browser script's rules, the last two through the .NET pipeline's - running in WebAssembly here - which are the same rules.

Livethe privacy rules
The page usedThe telemetry carries
/api/demo/echo?token=secret&[email protected]&q=ok.../api/demo/echo?token=REDACTED&email=REDACTED&q=ok
/api/demo/[email protected]&from=203.0.113.7.../api/demo/echo?q=[email]&from=[ip]
/api/demo/echo#access_token=abc123&token_type=bearer.../api/demo/echo
Payment failed for [email protected] with card 4111 1111 1111 1111Payment failed for [email] with card [card]
password = "hunter2", user.password = "hunter2", http.request.header.authorization = "Bearer abc123", password_policy = "min 12 characters", contact = "jane.doe@example.com" REDACTED, REDACTED, REDACTED, min 12 characters (not a credential name), [email]
"Confirmation sent to {Email} from {ClientIp}" with jane.doe@example.com, 203.0.113.7 Body Confirmation sent to [email] from [ip]; attributes Email = [email], ClientIp = [ip]
The live feed starts once the page is interactive.

Nothing yet - press a button, then open the record and read its url.full, exception.message or attributes.

The rules run in a fixed order, per attribute: blocked keys are removed; the ids (session.id, enduser.pseudo.id, user.id) are left to consent; a credential name gets REDACTED; URL attributes get parameter redaction; every other string is pattern-scrubbed. Long values are cut right after, and your processors see the result.

Query parameters

The values of the parameters in RedactQueryParameters are replaced with REDACTED in every URL attribute (url.full, page.referrer, ...), matched case-insensitively and after URL decoding. The parameter stays, so a dashboard can still tell the requests apart. The default list:

tokencodepasswordpwdsecretkeyapikeyapi_keyauthauthorizationsessionsidsigsignatureemailaccess_tokenid_tokenrefresh_tokenx-amz-signaturex-amz-credentialx-amz-security-tokenx-goog-signaturex-goog-credential

The list covers the signatures and credentials of pre-signed storage URLs too - Amazon S3's X-Amz-Signature, X-Amz-Credential and X-Amz-Security-Token, Google Cloud Storage's X-Goog-Signature and X-Goog-Credential, and an Azure SAS's sig - so a download link in a fetch span cannot be replayed from the telemetry. The url.query attribute gets the same redaction as a whole URL, and a user name and password in a URL's authority (https://user:secret@host/) are always dropped.

StripQueryString (off) drops the query entirely, for apps whose query strings are mostly personal - and url.query with it. StripFragment (on) drops the #... part, because OAuth implicit and hybrid flows return tokens there; with it off, parameters in the fragment are redacted like the query's.

builder.Services.AddBitBelemetryServices(options =>
{
    // Add your own parameter names to the defaults.
    options.Privacy.RedactQueryParameters.Add("customerId");
    options.Privacy.RedactQueryParameters.Add("invite");

    options.Privacy.StripQueryString = false;   // the default; true drops every query string
    options.Privacy.StripFragment = true;       // the default
});

Credential names

Some values are secret whatever they look like: a password has no pattern to recognize. The value of every attribute named in RedactedAttributes becomes REDACTED, in every record, span event, span link and metric point, on both sides. A log message that renders such a value keeps its template as the body, so the value is not in the message either. A name matches a key whole or its last dot-separated segment, case-insensitively - so the default password covers a structured log value {Password} and user.password alike, and authorization covers http.request.header.authorization, while password_policy is left alone. A trailing * matches a prefix instead (http.request.header.*). The defaults:

passwordpasswdpwdsecretclient_secrettokenaccess_tokenrefresh_tokenid_tokenapikeyapi_keyx-api-keyauthorizationproxy-authorizationcookieset-cookie
builder.Services.AddBitBelemetryServices(options =>
{
    // Add names of your own: whole keys or last segments, case-insensitive.
    options.Privacy.RedactedAttributes.Add("ssn");
    options.Privacy.RedactedAttributes.Add("http.request.header.*");   // a prefix: every request header

    // Or keep a default's values, when "token" means something harmless in your app.
    options.Privacy.RedactedAttributes.Remove("token");
});

// Anywhere: the value never leaves the process.
logger.LogInformation("Password reset for {UserName} with {Password}", userName, password);   // Password = REDACTED

Pattern scrubbing

With ScrubPatterns (on) these patterns are replaced wherever free text can carry them - log bodies, span status messages, and every string attribute (structured log values and event attributes included), in the browser script and in the .NET pipeline alike. Only the session and user ids, server.address and user_agent.original (whose four-part browser versions read as addresses) are kept verbatim. The patterns are applied in the order of the table.

PatternBecomesNotes
Bearer tokensBearer [token]Bearer followed by a token, case-insensitive
JSON Web Tokens[jwt]Three base64url segments starting with eyJ
E-mail addresses[email]name@domain.tld
Payment card numbers[card]13 to 19 digits, optionally grouped with spaces or dashes, and only when the Luhn checksum holds and the run neither starts with 0 nor repeats one digit - so order numbers, timestamps and all-zero ids survive
IPv4 addresses[ip]Except after Version=, so .NET assembly versions in stack traces stay readable; except in a value whose key is named like a version (AppVersion, app.version, build_version), where the other patterns still apply; and except the host of a URL and server.address - http://10.0.0.5:5000/api stays readable in a dependency, because it names the server that was called, not the user

Scrubbing is a safety net, not a design: a value you know is personal should never be logged in the first place, and structured attributes you control are better removed by name (below) than by pattern.

Blocked attributes and the user agent

BlockedAttributes removes attributes by exact key from every record, span event, span link and metric point, on both sides: the browser script gets the list in its configuration, and the .NET pipeline applies it to its own logs, spans and metrics, IBelemetry calls, and browser records relayed to it. The ids (session.id, enduser.pseudo.id, user.id) are governed by consent and untouched by every other privacy rule, but blocking one is the operator's explicit choice: a blocked id is never added to a record, and is removed from relayed browser records that carry it. Use a processor for anything more selective.

CollectUserAgent (on) puts the browser's user agent string in the browser resource as user_agent.original. Turn it off to keep only the coarse browser.* attributes (language, platform, mobile, brands). On Azure Monitor, MaskIp (on) keeps the ingestion service from deriving a location from the client IP; Belemetry never records the client IP itself.

builder.Services.AddBitBelemetryServices(options =>
{
    options.Privacy.ScrubPatterns = true;                    // the default
    options.Privacy.BlockedAttributes.Add("client.address"); // exact keys, browser and .NET
    options.Privacy.CollectUserAgent = false;                // drop user_agent.original
});

Long values

options.MaxValueLength (32768 characters) cuts longer attribute values, log bodies and span status messages - the OpenTelemetry attribute value length limit, applied to bodies too - so one serialized object or a huge stack trace cannot make a request too large to deliver. The cut comes after the privacy rules, so it never hides an e-mail address from them, and never splits a character in two. Zero keeps strings whole. Azure Monitor applies its own, smaller limits on top (see Azure mapping).

API

BelemetryPrivacyOptions Class

Data-minimization rules applied to every record, on both the browser and the .NET side, before it is queued.

Name Type and default Description
RedactQueryParameters List<string>= ["token", "code", "password", "pwd", "secret", "key", "apikey", "api_key", "auth", "authorization", "session", "sid", "sig", "signature", "email", "access_token", "id_token", "refresh_token", "x-amz-signature", "x-amz-credential", "x-amz-security-token", "x-goog-signature", "x-goog-credential"] Query-string parameters (case-insensitive) whose values are replaced with REDACTED in every URL attribute. The defaults include the signatures and credentials of pre-signed storage URLs (Amazon S3, Google Cloud Storage, Azure SAS sig), as the OpenTelemetry URL conventions redact them.
StripQueryString bool= false Whether to drop query strings from URLs entirely. Defaults to false.
StripFragment bool= true Whether to drop URL fragments (which may carry OAuth tokens). Defaults to true.
ScrubPatterns bool= true Whether messages, stack traces and URLs are scrubbed of e-mail addresses, JWTs, bearer tokens, card numbers (Luhn-checked) and IPv4 addresses. Defaults to true.
CollectUserAgent bool= true Whether the browser's user agent string is part of the browser resource. Defaults to true.
BlockedAttributes List<string>= [] Attribute keys removed from every record (exact match).
RedactedAttributes List<string>= ["password", "passwd", "pwd", "secret", "client_secret", "token", "access_token", "refresh_token", "id_token", "apikey", "api_key", "x-api-key", "authorization", "proxy-authorization", "cookie", "set-cookie"] Attribute names whose values are replaced with REDACTED in every record and span event, whatever the value looks like. A name matches an attribute key whole or its last dot-separated segment, case-insensitively - so password covers a structured log value {Password}, user.password and http.request.header.authorization alike, but not password_policy; a trailing * matches a key prefix instead (http.request.header.*). Defaults to credentials and cookies.
An unhandled error has occurred. Reload 🗙