Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions pipeline/filters/expect.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
---
description: >-
Made for testing: make sure that your records contain the expected key and
values
description: Testing your records for expected key and values
---

# Expect

The _expect_ filter plugin allows you to validate that records match certain criteria in their structure, like validating that a key exists or it has a specific value.
The _expect_ filter plugin lets you validate that records match certain criteria in their structure, like validating that a key exists or it has a specific value.

The following page just describes the configuration properties available, for a detailed explanation of its usage and use cases, please refer the following page:
For a detailed explanation of its usage and use cases, refer to [Validating and your Data and Structure](../../local-testing/validating-your-data-and-structure.md).

* [Validating and your Data and Structure](../../local-testing/validating-your-data-and-structure.md)

## Configuration Parameters
## Configuration parameters

The plugin supports the following configuration parameters:

| Property | Description |
| :--- | :--- |
| key\_exists | Check if a key with a given name exists in the record. |
| key\_not\_exists | Check if a key does not exist in the record. |
| key\_val\_is\_null | check that the value of the key is NULL. |
| key\_val\_is\_not\_null | check that the value of the key is NOT NULL. |
| key\_val\_eq | check that the value of the key equals the given value in the configuration. |
| action | action to take when a rule does not match. The available options are `warn` , `exit` or "result_key". On `warn`, a warning message is sent to the logging layer when a mismatch of the rules above is found; using `exit` makes Fluent Bit abort with status code `255`; `result_key` is to add a matching result to each record. |
| result\_key | specify a key name of matching result. This key is to be used only when 'action' is 'result_key'.|

## Getting Started

As mentioned on top, refer to the following page for specific details of usage of this filter:

* [Validating and your Data and Structure](../../local-testing/validating-your-data-and-structure.md)

| `key_exists` | Check if a key with a given name exists in the record. |
| `key_not_exists` | Check if a key doesn't exist in the record. |
| `key_val_is_null` | Check that the value of the key is `NULL`. |
| `key_val_is_not_null` | Check that the value of the key is `NOT NULL`. |
| `key_val_eq` | Check that the value of the key equals the given value in the configuration. |
| `action` | Action to take when a rule doesn't match. Available options are `warn` , `exit` or `result_key`. On `warn`, a warning message is sent to the logging layer when a mismatch of the `key*` rules is found. Using `exit` makes Fluent Bit exit with status code `255`. `result_key` adds a matching result to each record. |
| `result_key` | Specify a key name of matching result. Used only when `action` is `result_key`.|