Skip to content

Commit 1d760d0

Browse files
committed
wip
1 parent 4b245b8 commit 1d760d0

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

fluentbit/issue-lab-filter-as-a-processor-conditional-error/README.md

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
fluentbit:
3+
container_name: fluentbit
4+
image: fluent/fluent-bit:4.0.3
5+
volumes:
6+
- ./fluent-bit.yaml:/fluent-bit/fluent-bit.yaml
7+
develop:
8+
watch:
9+
- action: sync+restart
10+
path: ./fluent-bit.yaml
11+
target: /fluent-bit/fluent-bit.yaml
12+
command:
13+
- "fluent-bit"
14+
- "-c"
15+
- "/fluent-bit/fluent-bit.yaml"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
service:
2+
log_level: trace
3+
4+
pipeline:
5+
inputs:
6+
- name: dummy
7+
tag: dummy
8+
dummy: |
9+
{"stream": "stdout"}
10+
processors:
11+
logs:
12+
# this field is added, because the condition rule met
13+
- name: content_modifier
14+
action: insert
15+
key: field_add_only_if_stream_is_stdout
16+
value: foobar
17+
condition:
18+
op: and
19+
rules:
20+
- field: $stream
21+
op: eq
22+
value: stdout
23+
24+
# the field is not added, because the condition rule is not met
25+
- name: content_modifier
26+
action: insert
27+
key: field_add_only_if_stream_is_stderr
28+
value: foobar
29+
condition:
30+
op: and
31+
rules:
32+
- field: $stream
33+
op: eq
34+
value: stderr
35+
36+
# >>> BUG: the field is always added, ignoring the condition rule
37+
- name: lua
38+
call: main
39+
code: |
40+
function main(tag, timestamp, record)
41+
record["field_add_by_lua_if_stream_is_stderr"] = "BUG_DETECTED"
42+
return 1, timestamp, record
43+
end
44+
condition:
45+
op: and
46+
rules:
47+
- field: $stream
48+
op: eq
49+
value: stderr
50+
51+
# >>> BUG: the field is always added, ignoring the condition rule
52+
- name: modify
53+
match: '*'
54+
add:
55+
- field_add_by_modify_filter_if_stream_is_stderr BUG_DETECTED
56+
condition:
57+
op: and
58+
rules:
59+
- field: $stream
60+
op: eq
61+
value: stderr
62+
63+
outputs:
64+
- name: stdout
65+
format: json_lines
66+
match: "*"
67+
68+
# {
69+
# "date": 1751412593.244093,
70+
# "stream": "stdout",
71+
# "field_add_only_if_stream_is_stdout": "foobar",
72+
# "field_add_by_lua_if_stream_is_stderr": "BUG_DETECTED",
73+
# "field_add_by_modify_filter_if_stream_is_stderr": "BUG_DETECTED"
74+
# }

0 commit comments

Comments
 (0)