Skip to main content
Braintrust provides multiple ways to filter and search your logs, from quick UI filters to programmatic API access.

Filter menu

Select Filter to open the filter menu with quick filters for common fields like tags, time range, and comments. Use the Basic tab for point-and-click filtering, or switch to SQL to write precise queries. The SQL editor includes Generate button that creates queries from natural language descriptions.

Write SQL queries

Write SQL queries for precise filtering. When filtering logs, you can use either SQL or BTQL syntax:
WHERE scores.Factuality > 0.8
WHERE tags INCLUDES "production" AND metadata.user_id = "user-123"
WHERE created >= "2024-01-01" AND duration < 2.0
Both syntaxes support standard operators (=, !=, >, <, >=, <=), logical operators (AND/and, OR/or, NOT/not), and functions like INCLUDES/includes for array membership. For complete SQL documentation, see the SQL reference. Use AI-powered search to find traces based on meaning rather than exact keywords.

Ask questions with Loop

Select Loop to ask natural language questions about your logs. Loop understands your data structure and can answer questions, identify patterns, and help you find specific traces. For example:
  • “Show me traces where the user was confused”
  • “Find requests that took longer than usual”
  • “What are the most common error patterns?”

Find similar traces

Select rows in the logs table and use Find similar traces. Loop analyzes the selected traces to identify common traits and returns similar traces based on semantic meaning. Deep search finds traces based on semantic similarity rather than keyword matching. This helps you discover patterns, sentiment, and edge cases that traditional filtering might miss. See Use deep search for detailed examples and workflows.

API access

Query logs programmatically using the Braintrust API for automation, integrations, and custom tooling.

Basic filtering

Use the project logs endpoint for simple filters and programmatic access:
curl -X GET "https://api.braintrust.dev/v1/project/<PROJECT_ID>/logs" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json"

Advanced SQL queries

For complex queries, use the Braintrust API:
curl -X POST https://api.braintrust.dev/btql \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "select: * | from: project_logs('"'<PROJECT_ID>'"') | filter: scores.Factuality > 0.8 | limit: 100"
  }'
The API accepts these parameters:
  • query (required): Your BTQL query string
  • fmt: Response format (json or parquet, defaults to json)
  • tz_offset: Timezone offset in minutes for correct day boundaries
  • audit_log: Include audit log data

Next steps