# Filter by Condition

### Filter by Condition Processor

The Filter by Condition processor can be used to include or exclude telemetry based on a condition that is evaluated against the telemetry data.

### Supported Types

| Metrics | Logs | Traces |
| ------- | ---- | ------ |
| ✓       | ✓    | ✓      |

### Configuration

<table><thead><tr><th width="103.6875">Field</th><th>Description</th></tr></thead><tbody><tr><td>Choose Telemetry Type</td><td>The types of telemetry to filter.</td></tr><tr><td>Action</td><td>The action to take when the condition is met. Include will retain matching telemetry. Exclude will remove matching telemetry.</td></tr><tr><td>Condition</td><td>The condition to match against telemetry to include or exclude based on the action.</td></tr></tbody></table>

### Example Configuration

#### Excluding matching log records

In this example, we exclude logs that have **all** of the following:

* A `host.name` resource attribute that equals `dev-server`
* An `environment` attribute that equals `dev`
* A `remote-ip` log body field that equals `127.0.0.1`

#### Web Interface

<figure><img src="https://1405008107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgmiOMzBfoNFwmKJFHMcJ%2Fuploads%2FiEf8ZlYoSASmaZZ4b5xO%2Fxnapper-filter-condition.png?alt=media&#x26;token=9d4b860c-0928-4725-bf62-e381d7e175b6" alt="Bindplane docs - Filter by Condition"><figcaption></figcaption></figure>

### API Reference

This processor can be defined as yaml and applied using the [CLI](https://docs.bindplane.com/cli-and-api/cli) or API.

#### Type

filter-by-condition

#### Parameters

| Parameter        | Type                | Default                         | Description                                                                                                                   |
| ---------------- | ------------------- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| telemetry\_types | `telemetrySelector` | `["Logs", "Metrics", "Traces"]` | The types of telemetry to filter.                                                                                             |
| action           | `enum`              | `exclude`                       | The action to take when the condition is met. Include will retain matching telemetry. Exclude will remove matching telemetry. |
| condition        | `condition`         | `{"ottl":""}`                   | The condition to match against telemetry to include or exclude based on the action.                                           |

#### Standalone Processor

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Processor
metadata:
  name: filter-by-condition-example
spec:
  type: filter-by-condition
  parameters:
    - name: telemetry_types
      value:
        - Logs
    - name: action
      value: exclude
    - name: condition
      value:
        ottl: (resource.attributes["host.name"] == "dev-server" and attributes["environment"] == "dev" and body["remote-ip"] == "127.0.0.1")
        ui:
          statements:
            - key: host.name
              match: resource
              operator: Equals
              value: dev-server
            - key: environment
              match: attributes
              operator: Equals
              value: dev
            - key: remote-ip
              match: body
              operator: Equals
              value: 127.0.0.1
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bindplane.com/integrations/processors/filter-by-condition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
