View logs
To view logs, navigate to the Logs tab in the appropriate project in the Braintrust UI. Logs are automatically updated in real-time as new traces are logged.
Filter logs
Use the Filter menu to filter logs by tags, time range, and other fields.
View logged spans
Select Spans in the query shape dropdown to view all logged spans.
Create custom columns
Create custom columns to extract values from the root span.
Braintrust Query Language (BTQL)
Use Braintrust Query Language syntax to filter by arbitrary subfields.
Here are a few examples of common filters:
Description | Syntax |
---|---|
Logs older than the past day | created < CURRENT_DATE - INTERVAL 1 DAY |
Logs with a user_id field equal to 1234 | metadata.user_id = '1234' |
Logs with a Factuality score greater than 0.5 | scores.Factuality > 0.5 |
Query through the API
For basic filters and access to the logs, use the project logs endpoint. This endpoint supports the same query syntax as the UI and allows you to specify additional fields to return.
For more advanced queries, use the BTQL endpoint.
Tags
Braintrust supports curating logs by adding tags, and then filtering on them in the UI. Tags naturally flow between logs, to datasets, and even to experiments, so you can use them to track various kinds of data across your application, and track how they change over time.
Configure tags
Tags are configured at the project level, and in addition to a name, you can also specify a color and description. To configure tags, navigate to the Configuration tab in a project, where you can add, modify, and delete tags.
Add tags in the SDK
Specify the tags
field when you log data to add tags to logs using the SDK.
Tags can only be applied to top-level spans, e.g those created via traced()
or logger.startSpan()
/ logger.start_span()
. You cannot apply tags to
subspans (those created from another span), because they are properties of the
whole trace, not individual spans.
You can also apply tags while capturing feedback via the logFeedback()
/ log_feedback()
method.
Filter by tags
To filter by tags, select the tags you want to filter by in the UI.
Group related traces from a session
View multiple related traces in the logs trace panel based on different vectors, like by user, attribute, or tag. This is useful when working with complex applications to understand the full context of multi-step operations and related requests.
To view related traces:
- From the Logs page, select Group and select a tag or metadata path to group by
- Select a row to view that trace alongside other traces with the grouped attribute, including the value the traces are grouped by
- The table will show all rows included in the grouped session
Once the grouping is set in the table, the same grouping will carry over to other rows in the table.
- Use the thread view to see the entire session
- Use the timeline view to see the timing of operations
- Expand and collapse individual spans to focus on specific parts of the trace
- View detailed metadata, inputs, and outputs for each span
- Search for spans across every trace in the grouped session
Iterate on logged prompts in playgrounds
You can extract prompts and dataset inputs from logs and quickly iterate on them in playgrounds.
From the Logs page, bulk select the rows you would like to extract from. Then, select Iterate in playground to view the extracted prompts and dataset. Here, you can customize your playground (including optionally appending the extracted resources to existing resources) before selecting Create playground.