# Log Sampling

### Description

The Log Sampling processor can be used to filter out logs with a configured "drop ratio".

### Supported Types

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

### Configuration Table

<table><thead><tr><th width="114.18359375">Parameter</th><th width="96.30859375">Type</th><th width="107.21875">Default</th><th>Description</th></tr></thead><tbody><tr><td>drop_ratio</td><td><code>enum</code></td><td><code>"0.50"</code></td><td>The probability an entry is dropped (used for sampling). A value of 1.0 will drop 100% of matching entries, while a value of 0.0 will drop 0%.</td></tr><tr><td>condition</td><td>string</td><td><code>true</code></td><td>An <a href="https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.109.0/pkg/ottl#readme">OTTL</a> expression used to match which log records to sample from. All paths in the <a href="https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.109.0/pkg/ottl/contexts/ottllog/README.md">log context</a> are available to reference. All <a href="https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.109.0/pkg/ottl/ottlfuncs/README.md#converters">converters</a> are available to use.</td></tr></tbody></table>

{% hint style="info" %}
**NOTE**

Use of the `condition` parameter requires Bindplane Collector `v1.61.0` or above.
{% endhint %}

Value drop ratio's range from "0.0" (0%) to "1.00" (100%) with 5% increments. Note that the drop ratio value is a string.

### Example Configuration

Filter out 75% of logs where Attribute "ID" == 1.

**Web Interface**

<figure><img src="https://1405008107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgmiOMzBfoNFwmKJFHMcJ%2Fuploads%2Fgit-blob-a6097d0e85156ba2f393c09931a7b0019ce399b6%2Fintegrations-processors-log-sampling-image-1.png?alt=media" alt="Bindplane docs - Log Sampling - image 1"><figcaption></figcaption></figure>

**Standalone Processor**

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Processor
metadata:
  id: sampling
  name: sampling
spec:
  type: sampling
  parameters:
    - name: drop_ratio
      value: '0.75'
    - name: condition
      value: '(attributes["ID"] == 1)'
```
