> ## Documentation Index
> Fetch the complete documentation index at: https://docs.braintrust.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter logs by topic classification ID

> Use Loop to retrieve a Topics classification ID, then filter Logs or a dataset pipeline by that ID to isolate matching traces.

> [!NOTE]
>
> **Applies to:**
>
> * Plan -&#x20;
> * Deployment -&#x20;
> *
> * Use case - How to filter project logs with existing Topics classifications and promote matching traces into a dataset

## Summary

Topics classifications appear in **Logs**. If you cannot select a topic in the Issues dropdown or open filtered **Logs** from a topic, filter by its classification ID.

## What is happening

This workflow applies to project logs with existing Topics classifications. You can filter classifications by ID or label. Issues classification IDs are stored on source logs at `classifications.Issues.id`.

## Fix or suggestion

### Option 1: Use Loop to retrieve the classification ID (recommended)

1. Ask Loop to look up the classification ID with the following prompt:

   ```
   What is the classification ID for the "Entity Resolution Confusion" classification on the Issues facet (classifications.Issues.id)?
   ```

2. If Loop returns an ID, replace `<CLASSIFICATION_ID>` in the following filter, which applies to both the SQL filter in **Logs** and the source SQL filter in your dataset pipeline:

   ```sql theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
   classifications.Issues.id = '<CLASSIFICATION_ID>'
   ```

3. Go to [** Logs**](https://www.braintrust.dev/app/~/logs) and remove the previous filter that compares the Issues facet summary with the topic label.

4. Open **Add a structured filter** > **SQL**, enter the filter from step 2, and click **Apply**.

5. Set the **Logs** time range to cover the traces you want.

6. Select the matching traces loaded in **Logs**, click **Add to** > **Add to dataset**, and choose an existing dataset or create a new one. To promote the full matching set in bulk, use Option 2.

### Option 2: Use a dataset pipeline for bulk promotion

1. Follow the [Dataset pipelines guide](https://docs.braintrust.dev/annotate/datasets/pipelines.md) and use the SQL filter from Option 1 as the source SQL filter.

2. Set the pipeline's discovery window and limit to cover the traces you want.

## How to confirm it worked

* Before promoting logs with either option, confirm that the source logs have the expected topic label and that `classifications.Issues.id` matches the ID used in the filter.
* After promotion, confirm that the selected traces were added to the destination dataset.

## Notes

Filtering narrows the source logs. Promotion does not automatically preserve classification labels or IDs in dataset rows.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.