Skip to content

Commit 7884e27

Browse files
authored
Fixing indentation for Processors docs code examples needing to be 2 space standardized. Fixes #1969. (#1970)
* Fixing code example indent standards for conditional processing processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for conditional processing processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for content modifier processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for filters processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for filters processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for labels processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for metrics selector processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for opentelemetry envelope processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for smapling processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> * Fixing code example indent standards for SQL processor doc. Part of issue #1969. Signed-off-by: Eric D. Schabell <[email protected]> --------- Signed-off-by: Eric D. Schabell <[email protected]>
1 parent 161fc32 commit 7884e27

File tree

8 files changed

+608
-603
lines changed

8 files changed

+608
-603
lines changed

pipeline/processors/conditional-processing.md

Lines changed: 132 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Conditional processing is available in Fluent Bit version 4.0 and greater.
99
You can turn a standard processor into a conditional processor by adding a `condition` block to the processor's YAML configuration settings.
1010

1111
{% hint style="info" %}
12-
- Only [YAML configuration files](../administration/configuring-fluent-bit/yaml/README.md) support processors, including conditional processors.
13-
- Conditional processing isn't supported if you're using a [filter as a processor](../pipeline/processors/filters).
12+
- Only [YAML configuration files](../../administration/configuring-fluent-bit/yaml/README.md) support processors, including conditional processors.
13+
- Conditional processing isn't supported if you're using a [filter as a processor](../filters).
1414
{% endhint %}
1515

1616
These `condition` blocks use the following syntax:
@@ -20,22 +20,23 @@ These `condition` blocks use the following syntax:
2020

2121
```yaml
2222
pipeline:
23-
inputs:
23+
inputs:
2424
<...>
25-
processors:
26-
logs:
27-
- name: processor_name
28-
<...>
29-
condition:
30-
op: {and|or}
31-
rules:
32-
- field: {field_name1}
33-
op: {comparison_operator}
34-
value: {comparison_value1}
35-
- field: {field_name2}
36-
op: {comparison_operator}
37-
value: {comparison_value2}
38-
<...>
25+
26+
processors:
27+
logs:
28+
- name: processor_name
29+
<...>
30+
condition:
31+
op: {and|or}
32+
rules:
33+
- field: {field_name1}
34+
op: {comparison_operator}
35+
value: {comparison_value1}
36+
- field: {field_name2}
37+
op: {comparison_operator}
38+
value: {comparison_value2}
39+
<...>
3940
```
4041

4142
{% endtab %}
@@ -62,10 +63,11 @@ Each item in the `condition.rules` array must include values for the following p
6263

6364
Rules are evaluated against each log that passes through your data pipeline. For example, given a rule with these parameters:
6465

65-
```
66-
- field: "$status"
67-
op: eq
68-
value: 200
66+
```yaml
67+
rules:
68+
- field: "$status"
69+
op: eq
70+
value: 200
6971
```
7072
7173
This rule evaluates to `true` for a log that contains the string `'status':200`, but evaluates to `false` for a log that contains the string `'status':403`.
@@ -102,23 +104,23 @@ This example applies a condition that only processes logs that contain the strin
102104

103105
```yaml
104106
pipeline:
105-
inputs:
106-
- name: dummy
107-
dummy: '{"request": {"method": "GET", "path": "/api/v1/resource"}}'
108-
tag: request.log
109-
110-
processors:
111-
logs:
112-
- name: content_modifier
113-
action: insert
114-
key: modified_if_post
115-
value: true
116-
condition:
117-
op: and
118-
rules:
119-
- field: "$request['method']"
120-
op: eq
121-
value: "POST"
107+
inputs:
108+
- name: dummy
109+
dummy: '{"request": {"method": "GET", "path": "/api/v1/resource"}}'
110+
tag: request.log
111+
112+
processors:
113+
logs:
114+
- name: content_modifier
115+
action: insert
116+
key: modified_if_post
117+
value: true
118+
condition:
119+
op: and
120+
rules:
121+
- field: "$request['method']"
122+
op: eq
123+
value: "POST"
122124
```
123125

124126
{% endtab %}
@@ -133,26 +135,26 @@ This example applies a condition that only processes logs when all the specified
133135

134136
```yaml
135137
pipeline:
136-
inputs:
137-
- name: dummy
138-
dummy: '{"request": {"method": "POST", "path": "/api/v1/sensitive-data"}}'
139-
tag: request.log
140-
141-
processors:
142-
logs:
143-
- name: content_modifier
144-
action: insert
145-
key: requires_audit
146-
value: true
147-
condition:
148-
op: and
149-
rules:
150-
- field: "$request['method']"
151-
op: eq
152-
value: "POST"
153-
- field: "$request['path']"
154-
op: regex
155-
value: "\/sensitive-.*"
138+
inputs:
139+
- name: dummy
140+
dummy: '{"request": {"method": "POST", "path": "/api/v1/sensitive-data"}}'
141+
tag: request.log
142+
143+
processors:
144+
logs:
145+
- name: content_modifier
146+
action: insert
147+
key: requires_audit
148+
value: true
149+
condition:
150+
op: and
151+
rules:
152+
- field: "$request['method']"
153+
op: eq
154+
value: "POST"
155+
- field: "$request['path']"
156+
op: regex
157+
value: "\/sensitive-.*"
156158
```
157159

158160
{% endtab %}
@@ -167,26 +169,26 @@ This example applies a condition that only processes logs when one or more of th
167169

168170
```yaml
169171
pipeline:
170-
inputs:
171-
- name: dummy
172-
dummy: '{"request": {"method": "GET", "path": "/api/v1/resource", "status_code": 200, "response_time": 150}}'
173-
tag: request.log
174-
175-
processors:
176-
logs:
177-
- name: content_modifier
178-
action: insert
179-
key: requires_performance_check
180-
value: true
181-
condition:
182-
op: or
183-
rules:
184-
- field: "$request['response_time']"
185-
op: gt
186-
value: 100
187-
- field: "$request['status_code']"
188-
op: gte
189-
value: 400
172+
inputs:
173+
- name: dummy
174+
dummy: '{"request": {"method": "GET", "path": "/api/v1/resource", "status_code": 200, "response_time": 150}}'
175+
tag: request.log
176+
177+
processors:
178+
logs:
179+
- name: content_modifier
180+
action: insert
181+
key: requires_performance_check
182+
value: true
183+
condition:
184+
op: or
185+
rules:
186+
- field: "$request['response_time']"
187+
op: gt
188+
value: 100
189+
- field: "$request['status_code']"
190+
op: gte
191+
value: 400
190192
```
191193

192194
{% endtab %}
@@ -201,23 +203,23 @@ This example uses an array for the value of `condition.rules.value`:
201203

202204
```yaml
203205
pipeline:
204-
inputs:
205-
- name: dummy
206-
dummy: '{"request": {"method": "GET", "path": "/api/v1/resource"}}'
207-
tag: request.log
208-
209-
processors:
210-
logs:
211-
- name: content_modifier
212-
action: insert
213-
key: high_priority_method
214-
value: true
215-
condition:
216-
op: and
217-
rules:
218-
- field: "$request['method']"
219-
op: in
220-
value: ["POST", "PUT", "DELETE"]
206+
inputs:
207+
- name: dummy
208+
dummy: '{"request": {"method": "GET", "path": "/api/v1/resource"}}'
209+
tag: request.log
210+
211+
processors:
212+
logs:
213+
- name: content_modifier
214+
action: insert
215+
key: high_priority_method
216+
value: true
217+
condition:
218+
op: and
219+
rules:
220+
- field: "$request['method']"
221+
op: in
222+
value: ["POST", "PUT", "DELETE"]
221223
```
222224

223225
{% endtab %}
@@ -232,43 +234,43 @@ This example uses multiple processors with conditional processing enabled for ea
232234

233235
```yaml
234236
pipeline:
235-
inputs:
236-
- name: dummy
237-
dummy: '{"log": "Error: Connection refused", "level": "error", "service": "api-gateway"}'
238-
tag: app.log
239-
240-
processors:
241-
logs:
242-
- name: content_modifier
243-
action: insert
244-
key: alert
245-
value: true
246-
condition:
247-
op: and
248-
rules:
249-
- field: "$level"
250-
op: eq
251-
value: "error"
252-
- field: "$service"
253-
op: in
254-
value: ["api-gateway", "authentication", "database"]
255-
256-
- name: content_modifier
257-
action: insert
258-
key: paging_required
259-
value: true
260-
condition:
261-
op: and
262-
rules:
263-
- field: "$log"
264-
op: regex
265-
value: "(?i)(connection refused|timeout|crash)"
266-
- field: "$level"
267-
op: in
268-
value: ["error", "fatal"]
237+
inputs:
238+
- name: dummy
239+
dummy: '{"log": "Error: Connection refused", "level": "error", "service": "api-gateway"}'
240+
tag: app.log
241+
242+
processors:
243+
logs:
244+
- name: content_modifier
245+
action: insert
246+
key: alert
247+
value: true
248+
condition:
249+
op: and
250+
rules:
251+
- field: "$level"
252+
op: eq
253+
value: "error"
254+
- field: "$service"
255+
op: in
256+
value: ["api-gateway", "authentication", "database"]
257+
258+
- name: content_modifier
259+
action: insert
260+
key: paging_required
261+
value: true
262+
condition:
263+
op: and
264+
rules:
265+
- field: "$log"
266+
op: regex
267+
value: "(?i)(connection refused|timeout|crash)"
268+
- field: "$level"
269+
op: in
270+
value: ["error", "fatal"]
269271
```
270272

271273
{% endtab %}
272274
{% endtabs %}
273275

274-
This configuration adds an `alert` field to error logs from critical services, and adds a `paging_required` field to errors that contain specific critical patterns.
276+
This configuration adds an `alert` field to error logs from critical services, and adds a `paging_required` field to errors that contain specific critical patterns.

0 commit comments

Comments
 (0)