1
1
# Nest
2
2
3
- The _ Nest Filter _ plugin lets you operate on or with nested data. Its modes of operation are:
3
+ The _ Nest _ filter plugin lets you operate on or with nested data. Its modes of operation are:
4
4
5
- - ` nest ` - Take a set of records and place them in a map.
6
- - ` lift ` - Take a map by key and lift its records up.
5
+ - ` nest ` : Take a set of records and place them in a map.
6
+ - ` lift ` Take a map by key and lift its records up.
7
7
8
8
## Example usage for ` nest `
9
9
@@ -59,7 +59,7 @@ Output:
59
59
}
60
60
```
61
61
62
- ## Configuration Parameters
62
+ ## Configuration parameters
63
63
64
64
The plugin supports the following configuration parameters:
65
65
@@ -69,23 +69,21 @@ The plugin supports the following configuration parameters:
69
69
| ` Wildcard ` | FIELD WILDCARD | ` nest ` | Nest records which field matches the wildcard |
70
70
| ` Nest_under ` | FIELD STRING | ` nest ` | Nest records matching the ` Wildcard ` under this key |
71
71
| ` Nested_under ` | FIELD STRING | ` lift ` | Lift records nested under the ` Nested_under ` key |
72
- | ` Add_prefix ` | FIELD STRING | ANY | Prefix affected keys with this string |
73
- | ` Remove_prefix ` | FIELD STRING | ANY | Remove prefix from affected keys if it matches this string |
72
+ | ` Add_prefix ` | FIELD STRING | Any | Prefix affected keys with this string |
73
+ | ` Remove_prefix ` | FIELD STRING | Any | Remove prefix from affected keys if it matches this string |
74
74
75
- ## Getting Started
75
+ ## Get started
76
76
77
- To start filtering records, run the filter from the command line or through the
78
- configuration file. The following example invokes the
79
- [ Memory Usage Input Plugin] ( ../inputs/memory-metrics.md ) , which outputs the
80
- following:
77
+ To start filtering records, run the filter from the command line or through the configuration file. The following example invokes the
78
+ [ Memory Usage Input Plugin] ( ../inputs/memory-metrics.md ) , which outputs the following:
81
79
82
80
``` text
83
81
[0] memory: [1488543156, {"Mem.total"=>1016044, "Mem.used"=>841388, "Mem.free"=>174656, "Swap.total"=>2064380, "Swap.used"=>139888, "Swap.free"=>1924492}]
84
82
```
85
83
86
84
## Example 1 - nest
87
85
88
- ### Command Line
86
+ ### Use ` nest ` from the command Line
89
87
90
88
Using command line mode requires quotes to parse the wildcard properly. The use
91
89
of a configuration file is recommended.
@@ -98,7 +96,7 @@ wildcard rule to the keys and nests the keys matching `Mem.*` under the new key
98
96
bin/fluent-bit -i mem -p ' tag=mem.local' -F nest -p ' Operation=nest' -p ' Wildcard=Mem.*' -p ' Nest_under=Memstats' -p ' Remove_prefix=Mem.' -m ' *' -o stdout
99
97
```
100
98
101
- ### Configuration File
99
+ ### Nest configuration file
102
100
103
101
{% tabs %}
104
102
{% tab title="fluent-bit.conf" %}
@@ -145,7 +143,7 @@ pipeline:
145
143
{% endtab %}
146
144
{% endtabs %}
147
145
148
- ### Result
146
+ ### Nest result
149
147
150
148
The output of both the command line and configuration invocations should be identical and result in the following output.
151
149
@@ -154,12 +152,12 @@ The output of both the command line and configuration invocations should be iden
154
152
[0] mem.local : [1522978514.007359767, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "Memstats"=>{"total"=>4050908, "used"=>714984, "free"=>3335924}}]
155
153
` ` `
156
154
157
- ## Example 2 - nest and lift undo
155
+ ## Example 2 - ` nest` and ` lift` undo
158
156
159
157
This example nests all `Mem.*` and `Swap.*` items under the `Stats` key and then
160
158
reverses these actions with a `lift` operation. The output appears unchanged.
161
159
162
- # ## Example 2 Configuration File
160
+ # ## `nest` and `lift` undo configuration file
163
161
164
162
{% tabs %}
165
163
{% tab title="fluent-bit.conf" %}
@@ -220,19 +218,19 @@ pipeline:
220
218
{% endtab %}
221
219
{% endtabs %}
222
220
223
- # ## Result
221
+ # ## `nest` and `lift` undo result
224
222
225
223
` ` ` text
226
224
[2018/06/21 17:42:37] [ info] [engine] started (pid=17285)
227
225
[0] mem.local: [1529566958.000940636, {"Mem.total"=>8053656, "Mem.used"=>6940380, "Mem.free"=>1113276, "Swap.total"=>16532988, "Swap.used"=>1286772, "Swap.free"=>15246216}]
228
226
` ` `
229
227
230
- # # Example 3 - nest 3 levels deep
228
+ # # Example 3 - ` nest` 3 levels deep
231
229
232
230
This example takes the keys starting with `Mem.*` and nests them under `LAYER1`,
233
231
which is then nested under `LAYER2`, which is nested under `LAYER3`.
234
232
235
- # ## Example 3 Configuration File
233
+ # ## Deep `nest` configuration file
236
234
237
235
{% tabs %}
238
236
{% tab title="fluent-bit.conf" %}
@@ -300,7 +298,7 @@ pipeline:
300
298
{% endtab %}
301
299
{% endtabs %}
302
300
303
- # ## Result
301
+ # ## Deep `nest` Result
304
302
305
303
` ` ` text
306
304
[0] mem.local: [1524795923.009867831, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "LAYER3"=>{"LAYER2"=>{"LAYER1"=>{"Mem.total"=>4050908, "Mem.used"=>1112036, "Mem.free"=>2938872}}}}]
@@ -322,14 +320,14 @@ pipeline:
322
320
}
323
321
` ` `
324
322
325
- # # Example 4 - multiple nest and lift filters with prefix
323
+ # # Example 4 - multiple ` nest` and ` lift` filters with prefix
326
324
327
- This example uses the 3-level deep nesting of _Example 2_ and applies the
325
+ This example uses the 3-level deep nesting of Example 2 and applies the
328
326
` lift` filter three times to reverse the operations. The end result is that all
329
327
records are at the top level, without nesting, again. One prefix is added for each
330
328
level that's lifted.
331
329
332
- # ## Configuration file
330
+ # ## `nest` and `lift` prefix configuration file
333
331
334
332
{% tabs %}
335
333
{% tab title="fluent-bit.conf" %}
@@ -434,7 +432,7 @@ pipeline:
434
432
{% endtab %}
435
433
{% endtabs %}
436
434
437
- # ## Result
435
+ # ## `nest` and `lift` prefix result
438
436
439
437
` ` ` text
440
438
[0] mem.local: [1524862951.013414798, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "Lifted3_Lifted2_Lifted1_Mem.total"=>4050908, "Lifted3_Lifted2_Lifted1_Mem.used"=>1253912, "Lifted3_Lifted2_Lifted1_Mem.free"=>2796996}]
0 commit comments