Grouping logs by field in UI requires SQL sandbox

Last updated: February 26, 2026

Summary

Applicable To

Plans: All plans

Deployments: All

Issue: The logs viewer display dropdown shows grouping options for custom fields, but these options don't function when selected in the UI. This is particularly problematic when trying to group traces by custom metadata fields like thread_id to organize related logs.

Cause: Grouping by custom fields is not yet implemented in the logs viewer UI, though the options appear in the dropdown.

Resolution: Use the SQL sandbox to group logs by custom fields until UI support is added in a future release.

Use case: Grouping logs by custom metadata fields in the logs viewer

Resolution Steps

Workaround: Use SQL sandbox

Step 1: Navigate to SQL sandbox

Access the SQL sandbox from your Braintrust project.

Step 2: Query logs with GROUP BY

Write a SQL query to group logs by your custom field.

SELECT 
  metadata->>'thread_id' as thread_id,
  COUNT(*) as log_count,
  MIN(created) as first_log,
  MAX(created) as last_log
FROM logs
WHERE root_span = true
GROUP BY metadata->>'thread_id'
ORDER BY last_log DESC

Step 3: Analyze grouped results

Review the grouped logs to identify patterns or filter to specific groups of interest.