- Redact during ingestion: Braintrust receives your logs and sends unredacted text from selected fields to a detection model hosted on Baseten. Braintrust replaces detected sensitive text before storing the logs.
- Hide fields when read: Braintrust stores your logs and datasets unchanged and hides selected fields from some or all members when they view or query them.
- Redact before upload: An SDK masking function, span customizers, or
btspan plugins remove sensitive values within your application or on your machine. Values they remove are not sent to Braintrust.
Redact during ingestion
Ingestion redaction detects sensitive text, such as names, email addresses, and credentials, in incoming project logs and replaces it before storage. You define protected fields: named rules that each choose which log fields to scan and which types of sensitive information to redact. Create them for one project or your entire organization without changing your application code.
How redaction works
Redaction runs on incoming project logs before storage:- Select text: Braintrust applies the protected fields from your project and organization to identify which fields and entity types to scan. Each rule redacts only its own entity types in its own fields. Selected fields include strings nested in objects and arrays.
- Detect sensitive information: Braintrust sends unredacted text from the selected fields, with the name of the key that holds each value, to a Braintrust-managed detection model hosted on Baseten, a subprocessor. The model identifies text matching the rule’s entity types.
- Replace and store: Braintrust replaces the text identified by the model with category markers such as
[REDACTED_EMAIL], then stores the records. Text outside the detected spans and the object and array structure are preserved.
For organizations on the EU data plane, unredacted text selected for detection and its key names are sent to a Baseten-hosted model endpoint outside the EU. Using the EU data plane does not keep ingestion redaction processing within the EU.
Create protected fields
Only members of the Owners permission group can view or configure protected fields. Other members see a message that only organization owners can manage protected fields. Braintrust recommends creating protected fields at the project level during private preview.1
Choose the scope
Go to Settings > Data protection, then select a tab:
- Project: Redact logs in the selected project. The tab also lists rules inherited from your organization, labeled Inherited from organization, which you can’t edit or delete here.
- Organization: Redact logs in every existing and new project.
2
Define the rule
Click Protected field, then:
- Enter a Name for the rule.
- Set Stage to Ingest. The Action is Redact. If Applies to appears, keep it at Project logs.
- Under Entity types to redact, select at least one category, such as Names or Emails. Selecting a category redacts all of its types. To choose specific types, click the category again.
-
Under Fields to redact, click Field, then select a top-level field or enter a nested path such as
input.messages[0].content. On the Project tab, the list also suggests nested paths from the project’s logs, such asmetadata.user.email. Paths must start withinput,output,expected,error,metadata,comments, orcontext. Fields don’t need to exist in your logs yet. -
Optionally, under Fields to pass through, click Field and add paths that this rule never redacts, such as
input.messages[0].role. The rule skips each pass-through field and everything nested under it, so passing through a parent field also skips any redacted fields below it. Paths match exactly, soinput.messages[0].rolecovers only the first message. Other rules, including rules inherited from your organization, still redact the field if they include it. -
Optionally, under Values to never redact, add text this rule keeps, such as your company name. Type a value, then press Enter or click Value. To remove a value, click it.
If detected text contains a listed value, the rule redacts only the rest. For example, with
Adalisted,Ada LovelacebecomesAda [REDACTED_PERSON]. Matching ignores case and can match part of a word. Other rules can still redact the value. - Optionally, expand Preview rule to see example text redacted with the selected entity types.
- Click Create.
Available entity types
Available entity types
3
Verify the results
Send representative test logs, then go to Logs and inspect the covered fields.In LLM message views, rendered Markdown text, and the data editor, category markers appear as labeled pills. For example,
[REDACTED_EMAIL] displays as Redacted email address. Exports, API queries, and scorers receive the category marker text.Check for missed values and incorrect redactions before relying on the results. For values you can match reliably, such as known credential formats, also redact before upload.Change protected fields
After you create a protected field, you can edit its name, entity types, fields to redact, fields to pass through, and values to never redact. You can also disable or delete it. Changes apply to logs ingested after you save, and text that was already redacted stays redacted. Removing fields or entity types, adding pass-through fields or values to never redact, or disabling or deleting a rule stops redacting that text in new logs. The rule table on the Data protection page shows whether each rule is Enabled or Disabled.- Edit: Click a rule or its edit icon, change its settings, and click Save. You can’t change a rule’s Stage after you create it.
- Disable: Open the rule, turn off the Enabled switch, and click Save. The rule stops applying but keeps its configuration. Turn the switch back on to apply it again. Disabled organization rules don’t appear on the Project tab.
- Delete: Click the rule’s delete icon, or open the rule and click Delete, then confirm with Delete.
Failure behavior
Ingestion redaction fails open:- If redaction fails for a log record, Braintrust stores that record without ingestion redaction. Successfully redacted records in the same batch retain their redactions.
- If policy lookup or evaluation fails, Braintrust can store the entire batch without ingestion redaction.
- Ingestion redaction has a time budget of 45 seconds per batch by default, including policy lookup and redaction. If that budget expires, Braintrust stores unfinished records without ingestion redaction.
Hide fields when read
Read rules hide selected fields in project logs or datasets from some or all members, without changing stored data. Read rules don’t apply to experiments.
How read rules work
Read rules apply each time a member views or queries logs or datasets:- Store unchanged: Braintrust stores logs and datasets with their full values.
- Match the reader: Braintrust checks the project and organization read rules, and each rule’s Hide from setting, to decide which fields to hide from the member. Changes to permission group membership can take about a minute to take effect.
-
Remove hidden fields: Braintrust omits each hidden field, and everything nested under it, from the data the member reads. Trace, log, and dataset views mark where fields are hidden:
- A hidden field shows Hidden field in place of its value.
- An object with some hidden fields inside it shows Some fields hidden above the remaining content.
- A span’s raw data lists the hidden paths, labeled Hidden by protected-field rules.
Create read rules
Only members of the Owners permission group can view or configure read rules. Members who can’t configure read rules are still subject to them.1
Choose the scope
Go to Settings > Data protection, then select a tab:
- Project: Hide fields in the selected project’s logs or datasets. The tab also lists rules inherited from your organization, labeled Inherited from organization, which you can’t edit or delete here.
- Organization: Hide fields in every existing and new project.
2
Define the rule
Click Protected field, then:
- Enter a Name for the rule.
- Set Applies to to Project logs or Dataset. A Dataset rule covers every dataset in its scope.
- Set Stage to Read. The Action changes to Hide. Dataset rules use Read automatically.
- Under Fields to hide, click Field, then select a top-level field or enter a nested path such as
metadata.user. On the Project tab, the list also suggests nested paths from the project’s logs or datasets, such asmetadata.user.email. Paths must start withinput,output,expected,error,metadata,comments, orcontext. Fields don’t need to exist in your data yet. - Under Hide from, select an option:
- Everyone except specific members or groups: Hides the fields from every member, including members who join later, except the members and permission groups you select. To hide the fields from everyone, leave the selection at No one. The fields are also hidden from you unless you select yourself or one of your groups.
- Specific members and groups: Hides the fields only from the members and groups you select. Choose at least one member or group.
- Click Create.
Change read rules
After you create a read rule, you can edit its name, fields to hide, and Hide from selection. You can also disable or delete it. Changes apply to new views and queries as soon as you save. Braintrust stores the data unchanged, so disabling or deleting a rule loses nothing. The rule table on the Data protection page shows whether each rule is Enabled or Disabled, and what it Applies to.- Edit: Click a rule or its edit icon, change its settings, and click Save. You can’t change a rule’s Applies to or Stage after you create it. If the rule uses a condition that the Hide from options can’t represent, the dialog shows the condition as read-only and keeps it unchanged when you save.
- Disable: Open the rule, turn off the Enabled switch, and click Save. The fields become visible again, and the rule keeps its configuration. Turn the switch back on to hide them again. Disabled organization rules don’t appear on the Project tab.
- Delete: Click the rule’s delete icon, or open the rule and click Delete, then confirm with Delete. The fields become visible again.
Query limitations
If a query reads logs from several projects, a field hidden from you in one of those projects is hidden in every row the query returns. A query’s outermost select can return a hidden field, a field nested inside it, or a field that contains it, under its own name or a new one, such asmetadata, metadata.model, or metadata AS m. Braintrust removes the hidden parts from the returned column, or omits the column if the selected value is itself hidden.
Custom columns on the Logs page follow the same rules, so a custom column that reads a hidden field doesn’t block the page. How the column appears depends on what it does:
- Returns a hidden field, or a field nested inside or containing one, such as
input.input.commandormetadata: Shows only the parts that aren’t hidden, or no value if the returned value is itself hidden. - Computes on a hidden field, such as
len(input.input.command)orlower(input): Shows no value. - Has the same name as a built-in field, such as
project_id: Takes the place of that field and follows the rules above. - Is named
input: Causes the query to be rejected. A custom column namedinputthat doesn’t read a hidden field works as usual.
- Queries that filter, sort, group, aggregate, or compute on a hidden field, or on a field nested inside or containing it, including through a renamed column, such as
ORDER BY m, or a custom column. - Queries that rename one of these fields in a subquery. An outer query can rename a field that the subquery returns whole.
- Some selects of nested paths through arrays.
- Audit log queries.
- Async queries.
metadata.user is hidden from you, search skips all of metadata. Facets and classifications, which Topics builds on, are also hidden from you.
Redact before upload
To remove sensitive values before they reach Braintrust, change data before it leaves your application or machine. Braintrust SDKs provide masking functions and span customizers for data logged by your application, and thebt CLI provides span plugins for coding-agent traces:
- Masking functions: Functions that replace sensitive parts of field values, one value at a time, in a fixed set of fields:
input,output,expected,metadata,context,scores, andmetrics. The SDK runs your function on every record it logs. If it fails, the SDK uploads an error message in place of the affected field instead of the unmasked value. - Span customizers: Code that changes, adds, or removes fields on a span, including
tagsanderror. The SDK runs your customizers before it uploads each span. Which spans they cover, and what happens when one fails, depends on the SDK. - Span plugins: JavaScript modules that change coding-agent traces, which don’t pass through an SDK. The
btCLI runs your plugins on your machine before it uploads the traces. See Transform spans with JavaScript.
The C# SDK doesn’t support masking functions or span customizers. To remove sensitive data from its traces, use ingestion redaction, or remove it before you log it.
Next steps
- Explore advanced tracing to customize how your application records traces.
- Configure access control to manage who can read your projects and logs, and the permission groups that read rules can target.
- Set retention policies to control how long records are kept.