# Filter by Regex

### Filter by Regex Processor

The Filter by Regex processor can be used to include or exclude logs based on Regex matching body fields. This processor is exclusive to the Google license.

{% hint style="success" %}
**TIP**

We recommend using the [Filter By Condition](https://docs.bindplane.com/integrations/processors/filter-by-condition) processor for most use cases, as it provides more robust filtering options.
{% endhint %}

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

<table><thead><tr><th width="116.54296875">Field</th><th>Description</th></tr></thead><tbody><tr><td>Action</td><td>The action to take when the filter condition is met. Include will retain matching logs. Exclude will remove matching logs.</td></tr><tr><td>Regex</td><td>The regular expression (Regex) that logs will be evaluated against.</td></tr><tr><td>Match</td><td>The type containing the field the Regex will be evaluated against. Options are "Body" and "Attributes".</td></tr><tr><td>Field (Body)</td><td>If <code>Field Type</code> is set to "body", this is the name of the body field Regex will be evaluated against. Leave empty to apply to the entire body.</td></tr><tr><td>Field (Attributes)</td><td>If <code>Field Type</code> is set to "attributes", this is the name of the attribute field Regex will be evaluated against.</td></tr></tbody></table>

### Example Configuration

In this example, we exclude logs that have the body field "path" matching this Regex: `.+(?:ql)`.

**Web Interface**

<figure><img src="https://1405008107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgmiOMzBfoNFwmKJFHMcJ%2Fuploads%2Fgit-blob-8c50e05a82ce6450d19e193ba59954c4d54787af%2Fintegrations-processors-filter-by-regex-image-1.png?alt=media" alt="Bindplane docs - Filter by Regex - image 1"><figcaption></figcaption></figure>

**Standalone Processor**

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Processor
metadata:
  id: filter_regex
  name: filter_regex
spec:
  type: google_filter_regex
  parameters:
    - name: action
      value: exclude
    - name: regex
      value: '.+(?:ql)'
    - name: field_type
      value: 'Body'
    - name: body_field
      value: 'path'
```


---

# 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-regex.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.
