> For the complete documentation index, see [llms.txt](https://docs.bindplane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bindplane.com/feature-guides/ui-and-navigation/filtering-with-query-syntax.md).

# Filtering with Query Syntax

The Bindplane query syntax provides a powerful way to filter and search resources using a flexible token-based format.

This guide covers how to use the `--query` flag in the CLI and equivalent filtering in the UI using the Filter bar on the Collectors and Configurations pages.

## What is Query Syntax?

Query syntax allows you to filter and search Bindplane resources using a token-based format. You can filter collectors by status, platform, version, and other fields, search by labels and configuration names, use negation operators to exclude specific criteria, match any of several values for a field with OR logic, and combine multiple conditions with AND logic.

## Basic Syntax

### Token Format

Queries are composed of space-separated tokens in the format:

```
[operator]name:value
```

#### Operators

* **`+`** (optional): Positive match (default)
* **`-`** : Negation (NOT match)
* **No operator**: Positive match (default)

#### Combining Tokens

* **Space** between tokens: AND. A collector must match every token. See [Combining Conditions (AND)](#combining-conditions-and).
* **Comma** between values in one token: OR. A collector must match at least one of the values. See [Matching Any of Several Values (OR)](#matching-any-of-several-values-or).

## Field-Based Filtering

### Collector Status

Filter collectors by their connection and operational status:

```bash
# Find connected collectors
bindplane get collectors --query "status:Connected"

# Find disconnected collectors
bindplane get collectors --query "status:Disconnected"

# Find collectors with errors
bindplane get collectors --query "status:Error"

# Find collectors that are NOT disconnected
bindplane get collectors --query "-status:Disconnected"
```

**Available Status Values:**

* `Connected` - Collector is connected and healthy
* `Disconnected` - Collector is not connected
* `Error` - Collector has an error
* `Configuring` - Collector is applying a new configuration
* `Deleted` - Collector is marked for deletion
* `Upgrading` - Collector is upgrading
* `Pending` - Collector is queued for configuration
* `Incompatible` - Collector configuration is incompatible

### Platform and Architecture

Filter by system characteristics:

```bash
# Find Linux collectors
bindplane get collectors --query "platform:linux"

# Find Windows collectors
bindplane get collectors --query "platform:windows"

# Find collectors on specific architecture
bindplane get collectors --query "arch:amd64"

# Find collectors that are NOT on Linux
bindplane get collectors --query "-platform:linux"
```

### Version Management

Filter by collector version:

```bash
# Find collectors with specific version
bindplane get collectors --query "version:v1.30.0"

# Find collectors with latest version (auto-resolved)
bindplane get collectors --query "version:latest"

# Find collectors that are out of date
bindplane get collectors --query "outOfDate:true"

# Find collectors that are NOT out of date
bindplane get collectors --query "-outOfDate:true"
```

### Collector Type and Identity

Filter by collector type and identification:

```bash
# Find specific collector type
bindplane get collectors --query "type:observiq-otel-collector"

# Find collectors by hostname pattern
bindplane get collectors --query "hostname:web-*"

# Find collectors by name
bindplane get collectors --query "name:production-collector"

# Find collectors by MAC address
bindplane get collectors --query "macAddress:00:11:22:33:44:55"
```

## Label-Based Filtering

Labels are key-value pairs that provide flexible categorization:

```bash
# Find collectors with specific environment label
bindplane get collectors --query "environment:production"

# Find collectors without a specific label
bindplane get collectors --query "-environment:test"

# Find collectors with any value for a label key
bindplane get collectors --query "environment:"
```

## Configuration-Based Filtering

Filter collectors by their configuration assignments:

```bash
# Find collectors with specific current configuration
bindplane get collectors --query "configuration-current:my-config:1"

# Find collectors with pending configuration
bindplane get collectors --query "configuration-pending:new-config:2"

# Find collectors with future configuration
bindplane get collectors --query "configuration-future:upgrade-config:3"
```

## Rollout-Based Filtering

Filter collectors by their rollout status:

```bash
# Find collectors with completed rollouts
bindplane get collectors --query "rollout-complete:config-name"

# Find collectors with rollout errors
bindplane get collectors --query "rollout-error:config-name"

# Find collectors with incompatible rollouts
bindplane get collectors --query "rollout-incompatible:config-name"

# Find collectors with pending rollouts
bindplane get collectors --query "rollout-pending:config-name"

# Find collectors waiting for rollouts
bindplane get collectors --query "rollout-waiting:config-name"
```

## Text Search

Perform substring matching across all searchable fields:

```bash
# Find collectors containing "prod" in any field
bindplane get collectors --query "prod"

# Find collectors containing "web" in any field
bindplane get collectors --query "web"

# Find collectors NOT containing "test" in any field
bindplane get collectors --query "-test"
```

## Matching Any of Several Values (OR)

Separate values with a comma to match collectors where a field has any of the listed values. The comma works as OR inside a single token, while separate tokens are still combined with AND.

```bash
# Find collectors assigned the syslog or iis configuration
bindplane get collectors --query "configuration:syslog,iis"

# Find collectors that are connected or configuring
bindplane get collectors --query "status:Connected,Configuring"

# Find Linux or Windows collectors
bindplane get collectors --query "platform:linux,windows"

# Find collectors that are in error on either Linux or Windows
bindplane get collectors --query "platform:linux,windows status:Error"
```

Negating a comma-separated token excludes every listed value:

```bash
# Find collectors that are neither connected nor disconnected
bindplane get collectors --query "-status:Connected,Disconnected"
```

Spaces after commas are allowed, so `status:Connected, Configuring` behaves the same as `status:Connected,Configuring`. To include a comma or space inside a value, wrap that value in quotes:

```bash
bindplane get collectors --query 'configuration:"my config","other config"'
```

{% hint style="info" %}
Comma-separated OR works on built-in fields such as `status`, `platform`, `arch`, `version`, `hostname`, `name`, `type`, and the `configuration` fields. It does not apply to label values. A label query uses only the first value, so `environment:production,staging` matches collectors labeled `environment=production` but not those labeled `environment=staging`.
{% endhint %}

## Combining Conditions (AND)

Separate tokens with spaces to combine conditions. A collector must match every token to appear in the results:

```bash
# Find connected Linux collectors with specific configuration
bindplane get collectors --query "status:Connected platform:linux configuration:prod-config"

# Find collectors that are NOT disconnected and have latest version
bindplane get collectors --query "-status:Disconnected version:latest"

# Find collectors with error status and a specific hostname pattern
bindplane get collectors --query "status:Error hostname:web-*"

# Find collectors with error or disconnected status on a specific configuration
bindplane get collectors --query "status:Error,Disconnected configuration:prod-config"

# Find production collectors that are NOT out of date
bindplane get collectors --query "environment:production -outOfDate:true"
```

{% hint style="info" %}
Repeating a field with two different exact values, as in `status:Connected status:Error`, returns no results because no collector can have both values. To match either value, use a comma instead: `status:Connected,Error`.
{% endhint %}

## Quoted Values

Use quotes to include spaces in values:

```bash
# Find collectors with configuration containing spaces
bindplane get collectors --query 'configuration:"my production config"'

# Find collectors with hostname containing spaces
bindplane get collectors --query 'hostname:"web server 01"'
```

## Using Queries with Commands

### Get Command

```bash
# Filter collectors for display
bindplane get collectors --query "status:Connected platform:linux"
```

### Delete Command

```bash
# Delete collectors matching query (use with caution)
bindplane delete collector --query "environment:test status:Disconnected"
```

### Label Command

```bash
# Add labels to collectors matching query
bindplane label collector --query "platform:linux" --add "maintenance=true"

# Remove labels from collectors matching query
bindplane label collector --query "environment:staging" --remove "old-label"
```

## UI Filtering Equivalents

In the Bindplane UI, you have access to the same filtering.

### Collector List Filters

* **Status dropdown**: Equivalent to `status:Connected`
* **Platform filter**: Equivalent to `platform:linux`
* **Search box**: Equivalent to text search tokens
* **Label filters**: Equivalent to label-based queries

### Advanced Search

The UI search box supports the same query syntax as the CLI.

* Type `status:Connected` to filter by status
* Type `platform:linux` to filter by platform
* Type `environment:production` to filter by labels
* Type `configuration:syslog,iis` to show collectors with either configuration

## Common Use Cases

### Environment Management

```bash
# Find all production collectors
bindplane get collectors --query "environment:production"

# Find staging collectors that are connected
bindplane get collectors --query "environment:staging status:Connected"

# Find test collectors that are disconnected (for cleanup)
bindplane get collectors --query "environment:test status:Disconnected"
```

### Maintenance Operations

```bash
# Find collectors that need updates
bindplane get collectors --query "outOfDate:true"

# Find collectors with specific version for upgrade
bindplane get collectors --query "version:v1.29.0"

# Find collectors with errors for troubleshooting
bindplane get collectors --query "status:Error"
```

### Configuration Management

```bash
# Find collectors using specific configuration
bindplane get collectors --query "configuration:web-config"

# Find collectors with pending configuration changes
bindplane get collectors --query "configuration-pending:"

# Find collectors with rollout errors
bindplane get collectors --query "rollout-error:"
```

### Platform-Specific Operations

```bash
# Find all Linux collectors
bindplane get collectors --query "platform:linux"

# Find Windows collectors with specific version
bindplane get collectors --query "platform:windows version:v1.30.0"

# Find collectors by architecture
bindplane get collectors --query "arch:arm64"
```

## Examples Summary

| Use Case                             | Query Example              |
| ------------------------------------ | -------------------------- |
| Find connected collectors            | `status:Connected`         |
| Find Linux collectors                | `platform:linux`           |
| Find production collectors           | `environment:production`   |
| Find collectors with errors          | `status:Error`             |
| Find collectors needing updates      | `outOfDate:true`           |
| Find collectors with specific config | `configuration:web-config` |
| Find collectors NOT in test          | `-environment:test`        |
| Find collectors with latest version  | `version:latest`           |
| Find collectors by hostname pattern  | `hostname:web-*`           |
| Find collectors with rollout errors  | `rollout-error:`           |
| Find collectors with either config   | `configuration:syslog,iis` |

The query syntax provides a powerful and flexible way to filter Bindplane resources, enabling efficient management and automation of your telemetry infrastructure.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bindplane.com/feature-guides/ui-and-navigation/filtering-with-query-syntax.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
