Skip to content

Commit c02b7bd

Browse files
authored
Merge pull request #402 from VirtualMetric:DT-588-new-processors
DT-588-new-processors
2 parents 96d34fd + 700a920 commit c02b7bd

File tree

11 files changed

+1158
-17
lines changed

11 files changed

+1158
-17
lines changed

docs/about/key-features.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ The pipeline architecture is designed with flexibility and ease of use in mind,
135135

136136
<Image id="feature-processor-support" maxWidth="250px"/>
137137

138-
Offering **169+** processors, **DataStream** has the most comprehensive support in the industry for _low-code_/_no-code_ management, enabling tasks like parsing, filtering, enrichment, schema transformation, normalization, routing, and more. Engineers with **Elastic** experience can leverage this robust and flexible pipeline engine while benefiting from extended multi-platform capabilities.
138+
Offering **174+** processors, **DataStream** has the most comprehensive support in the industry for _low-code_/_no-code_ management, enabling tasks like parsing, filtering, enrichment, schema transformation, normalization, routing, and more. Engineers with **Elastic** experience can leverage this robust and flexible pipeline engine while benefiting from extended multi-platform capabilities.
139139

140140
Key capabilities include:
141141

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
description: Halts execution of remaining processors in the current pipeline chain and forwards the log entry to its target
3+
sidebar_custom_props:
4+
customCategory: Flow Control
5+
customIcon:
6+
---
7+
8+
# Break
9+
10+
<span className="theme-doc-version-badge badge badge--primary">Flow Control</span>
11+
12+
## Synopsis
13+
14+
Halts the remaining processors in the current pipeline chain and forwards the log entry to its target without further processing, similar to a `break` statement in programming languages.
15+
16+
## Schema
17+
18+
```yaml
19+
- break:
20+
description: <text>
21+
if: <script>
22+
ignore_failure: <boolean>
23+
on_failure: <processor[]>
24+
on_success: <processor[]>
25+
tag: <string>
26+
```
27+
28+
## Configuration
29+
30+
The following fields are used to define the processor:
31+
32+
|Field|Required|Default|Description|
33+
|---|---|---|---|
34+
|`description`|N||Explanatory note|
35+
|`if`|N||Condition to run|
36+
|`ignore_failure`|N|`false`|Continue processing if operation fails|
37+
|`on_failure`|N||See <Topic id="pipelines-handling-failures">Handling Failures</Topic>|
38+
|`on_success`|N||See <Topic id="pipelines-handling-success">Handling Success</Topic>|
39+
|`tag`|N||Identifier|
40+
41+
## Details
42+
43+
The `break` processor stops execution of all remaining processors in the current pipeline chain. The log entry is not dropped — it is forwarded to its configured target as-is, with all field values set up to the point of the break.
44+
45+
This processor has no required fields. When used without an `if` condition, it unconditionally halts further processing. The most common usage is with an `if` expression to conditionally exit the pipeline when specific criteria are met.
46+
47+
The `break` processor is classified as a finalizer: once triggered, the pipeline engine stops processing the current processor list and returns the log entry for delivery.
48+
49+
## Examples
50+
51+
### Unconditional Break
52+
53+
<ExampleGrid>
54+
<CommentCol>
55+
Halting all further processing unconditionally...
56+
</CommentCol>
57+
<CodeCol>
58+
```json
59+
{
60+
"source": {"ip": "192.168.1.1"},
61+
"event": {"action": "login"}
62+
}
63+
```
64+
```yaml
65+
- set:
66+
field: processed
67+
value: true
68+
- break:
69+
description: "Stop processing here"
70+
- set:
71+
field: should_not_appear
72+
value: true
73+
```
74+
</CodeCol>
75+
<CommentCol>
76+
Processing stops at break; log entry is forwarded with only the fields set before break...
77+
</CommentCol>
78+
<CodeCol>
79+
```json
80+
{
81+
"source": {"ip": "192.168.1.1"},
82+
"event": {"action": "login"},
83+
"processed": true
84+
}
85+
```
86+
</CodeCol>
87+
</ExampleGrid>
88+
89+
### Conditional Break
90+
91+
<ExampleGrid>
92+
<CommentCol>
93+
Stopping processing when packet count matches condition...
94+
</CommentCol>
95+
<CodeCol>
96+
```json
97+
{
98+
"source": {"packets": 10},
99+
"network": {"protocol": "tcp"}
100+
}
101+
```
102+
```yaml
103+
- set:
104+
field: initial_check
105+
value: true
106+
- break:
107+
if: "ctx.source.packets == 10"
108+
description: "Exit early for 10-packet events"
109+
- geo_ip:
110+
field: source.ip
111+
target: source.geo
112+
- threat_intel:
113+
field: source.ip
114+
```
115+
</CodeCol>
116+
<CommentCol>
117+
Pipeline halts when condition is met; expensive enrichment processors are skipped...
118+
</CommentCol>
119+
<CodeCol>
120+
```json
121+
{
122+
"source": {"packets": 10},
123+
"network": {"protocol": "tcp"},
124+
"initial_check": true
125+
}
126+
```
127+
</CodeCol>
128+
</ExampleGrid>
129+
130+
### Break with `on_success` Notification
131+
132+
<ExampleGrid>
133+
<CommentCol>
134+
Marking the log entry before breaking out of the pipeline...
135+
</CommentCol>
136+
<CodeCol>
137+
```json
138+
{
139+
"event": {"type": "heartbeat"},
140+
"host": {"name": "monitor-01"}
141+
}
142+
```
143+
```yaml
144+
- break:
145+
if: "ctx.event.type == 'heartbeat'"
146+
description: "Skip enrichment for heartbeat events"
147+
on_success:
148+
- set:
149+
field: pipeline.skipped
150+
value: true
151+
- enrich:
152+
field: host.name
153+
target: host.details
154+
```
155+
</CodeCol>
156+
<CommentCol>
157+
Heartbeat events exit early with the skip marker set; non-heartbeat events proceed to enrichment...
158+
</CommentCol>
159+
<CodeCol>
160+
```json
161+
{
162+
"event": {"type": "heartbeat"},
163+
"host": {"name": "monitor-01"},
164+
"pipeline": {"skipped": true}
165+
}
166+
```
167+
</CodeCol>
168+
</ExampleGrid>

docs/configuration/pipelines/processors/contains.mdx

Lines changed: 74 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_custom_props:
77

88
# Contains
99

10-
<span className="theme-doc-version-badge badge badge--primary">Control Flow</span>
10+
<span className="theme-doc-version-badge badge badge--primary">Flow Control</span>
1111

1212
## Synopsis
1313

@@ -18,14 +18,17 @@ Checks if a specified field value exists within a list of values, enabling condi
1818
```yaml {2}
1919
- contains:
2020
field: <ident>
21+
case_sensitive: <boolean>
2122
description: <text>
23+
disabled: <boolean>
2224
if: <script>
2325
ignore_failure: <boolean>
2426
ignore_missing: <boolean>
2527
list: <string[]>
2628
list_field: <ident>
2729
on_failure: <processor[]>
2830
on_success: <processor[]>
31+
partial: <boolean>
2932
tag: <string>
3033
```
3134
@@ -35,23 +38,32 @@ The following fields are used to define the processor:
3538
3639
|Field|Required|Default|Description|
3740
|---|---|---|---|
38-
|`field`|Y|-|Field containing the value to check|
39-
|`description`|N|-|Explanatory note|
40-
|`if`|N|-|Condition to run|
41+
|`field`|Y||Field containing the value to check|
42+
|`case_sensitive`|N|`false`|When `true`, comparisons are case-sensitive|
43+
|`description`|N||Explanatory note|
44+
|`disabled`|N|`false`|When `true`, processor is skipped|
45+
|`if`|N||Condition to run|
4146
|`ignore_failure`|N|`false`|See <Topic id="pipelines-handling-failures">Handling Failures</Topic>|
42-
|`ignore_missing`|N|`false`|If `true` and `field` does not exist, exit quietly without making any modifications|
43-
|`list`|N|-|Static list of values to check against|
44-
|`list_field`|N|-|Field containing the dynamic list of values to check against|
45-
|`on_failure`|N|-|See <Topic id="pipelines-handling-failures">Handling Failures</Topic>|
46-
|`on_success`|N|-|See <Topic id="pipelines-handling-success">Handling Success</Topic>|
47-
|`tag`|N|-|Identifier|
47+
|`ignore_missing`|N|`false`|If `true` and `field` does not exist, exit quietly|
48+
|`list`|N||Static list of values to check against|
49+
|`list_field`|N||Field containing a dynamic `[]string` list to check against|
50+
|`on_failure`|N||See <Topic id="pipelines-handling-failures">Handling Failures</Topic>|
51+
|`on_success`|N||See <Topic id="pipelines-handling-success">Handling Success</Topic>|
52+
|`partial`|N|`false`|When `true`, uses substring matching instead of exact equality|
53+
|`tag`|N||Identifier|
4854

49-
# Details
55+
## Details
5056

51-
The list can be provided directly or referenced from another field.
57+
The processor checks whether the string value of `field` appears in a list of candidate values. The list is provided via `list` (static values defined inline) or `list_field` (a `[]string` field in the log entry). If both are set, `list_field` takes precedence. At least one must be specified; otherwise the processor fails with "no member specified".
5258

53-
:::warning
54-
Either `list` or `list_field` must be specified, but not both, and the field being checked must contain a string value. The processor will fail if neither `list` nor `list_field` is provided, or if the specified field contains a non-string value.
59+
By default, comparison is **exact equality** and **case-insensitive**. Set `case_sensitive: true` for exact-case matching.
60+
61+
When `partial` is `true`, the check changes from exact equality to bidirectional substring matching: the processor succeeds if the field value contains any list member as a substring, **or** if any list member contains the field value as a substring.
62+
63+
List values support template syntax (`{{{field_name}}}`), allowing dynamic values constructed from other fields in the log entry.
64+
65+
:::note
66+
For pattern-based matching (substring or regex) against a single value rather than a list, see <Topic id="processors-matches">Matches</Topic>.
5567
:::
5668

5769
## Examples
@@ -127,6 +139,54 @@ Either `list` or `list_field` must be specified, but not both, and the field bei
127139
</CommentCol>
128140
</ExampleGrid>
129141

142+
### Partial Match
143+
144+
<ExampleGrid>
145+
<CommentCol>
146+
Checking if a field value contains any list member as a substring...
147+
</CommentCol>
148+
<CodeCol>
149+
```json
150+
{
151+
"event_type": "user.login.success"
152+
}
153+
```
154+
```yaml
155+
- contains:
156+
field: event_type
157+
list: ["login", "logout"]
158+
partial: true
159+
```
160+
</CodeCol>
161+
<CommentCol>
162+
returns success because `"user.login.success"` contains `"login"`
163+
</CommentCol>
164+
</ExampleGrid>
165+
166+
### Case Sensitive
167+
168+
<ExampleGrid>
169+
<CommentCol>
170+
Requiring exact case when checking against a list...
171+
</CommentCol>
172+
<CodeCol>
173+
```json
174+
{
175+
"severity": "WARNING"
176+
}
177+
```
178+
```yaml
179+
- contains:
180+
field: severity
181+
list: ["warning", "error", "critical"]
182+
case_sensitive: true
183+
```
184+
</CodeCol>
185+
<CommentCol>
186+
returns no match because `"WARNING"` does not equal `"warning"` in case-sensitive mode
187+
</CommentCol>
188+
</ExampleGrid>
189+
130190
### Templates
131191

132192
<ExampleGrid>

0 commit comments

Comments
 (0)