Skip to content

Commit e76f785

Browse files
committedJan 13, 2025··
pipelines: filters: parser: Add a nest_under parameter
Signed-off-by: Ra'Jiska <dodo.lasticot@gmail.com>
1 parent 397a33a commit e76f785

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 

‎pipeline/filters/parser.md

+41
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The plugin supports the following configuration parameters:
1212
| Parser | Specify the parser name to interpret the field. Multiple _Parser_ entries are allowed \(one per line\). | |
1313
| Preserve\_Key | Keep original `Key_Name` field in the parsed result. If false, the field will be removed. | False |
1414
| Reserve\_Data | Keep all other original fields in the parsed result. If false, all other original fields will be removed. | False |
15+
| Reserve\_Data | Keep all other original fields in the parsed result. If false, all other original fields will be removed. | False |
16+
| Nest\_Under | Specify field name to nest parsed records under. | |
1517

1618
## Getting Started
1719

@@ -156,3 +158,42 @@ Fluent Bit v2.1.1
156158
[0] dummy.data: [[1687122779.296906553, {}], {"INT"=>"100", "FLOAT"=>"0.5", "BOOL"=>"true", "STRING"=>"This is example", "data"=>"100 0.5 true This is example", "key1"=>"value1", "key2"=>"value2"}]
157159
[0] dummy.data: [[1687122780.297475803, {}], {"INT"=>"100", "FLOAT"=>"0.5", "BOOL"=>"true", "STRING"=>"This is example", "data"=>"100 0.5 true This is example", "key1"=>"value1", "key2"=>"value2"}]
158160
```
161+
162+
### Nest parsed fields
163+
164+
Instead of expanding parsed fields at the root of the object,
165+
you may choose to have them nested under a new field defined by `Nest_Under`:
166+
167+
```python copy
168+
[SERVICE]
169+
Parsers_File /fluent-bit/etc/parsers.conf
170+
171+
[INPUT]
172+
Name Dummy
173+
Dummy {"log":"error: my error","element":"{\"a\":\"b\",\"c\":{\"x\":\"y\"}}"}
174+
Tag dummy.data
175+
176+
[FILTER]
177+
Name parser
178+
Match dummy.*
179+
Parser json
180+
Key_Name element
181+
Nest_Under parsed
182+
183+
[OUTPUT]
184+
Name stdout
185+
Match *
186+
```
187+
188+
Resulting in the following output:
189+
190+
```text
191+
$ fluent-bit -c dummy.conf
192+
Fluent Bit v2.1.1
193+
* Copyright (C) 2015-2022 The Fluent Bit Authors
194+
...
195+
...
196+
[0] dummy.data: [[1736759501.208000317, {}], {"parsed"=>{"a"=>"b", "c"=>{"x"=>"y"}}}]
197+
[0] dummy.data: [[1736759502.207935361, {}], {"parsed"=>{"a"=>"b", "c"=>{"x"=>"y"}}}]
198+
[0] dummy.data: [[1736759503.207765898, {}], {"parsed"=>{"a"=>"b", "c"=>{"x"=>"y"}}}]
199+
```

0 commit comments

Comments
 (0)
Please sign in to comment.