Skip to content

Commit 335c4cb

Browse files
authored
Merge pull request #1693 from fluent/lynettemiles/sc-136154/update-fluent-bit-docs-pipeline-filters-nest
2 parents d3f4581 + fe6b2b7 commit 335c4cb

File tree

1 file changed

+23
-31
lines changed

1 file changed

+23
-31
lines changed

pipeline/filters/nest.md

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Nest
22

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:
44

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.
77

88
## Example usage for `nest`
99

@@ -59,7 +59,7 @@ Output:
5959
}
6060
```
6161

62-
## Configuration Parameters
62+
## Configuration parameters
6363

6464
The plugin supports the following configuration parameters:
6565

@@ -69,26 +69,22 @@ The plugin supports the following configuration parameters:
6969
| `Wildcard` | FIELD WILDCARD | `nest` | Nest records which field matches the wildcard |
7070
| `Nest_under` | FIELD STRING | `nest` | Nest records matching the `Wildcard` under this key |
7171
| `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 |
7474

75-
## Getting Started
75+
## Get started
7676

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 [Memory Usage input plugin](../inputs/memory-metrics.md), which outputs the following:
8178

8279
```text
8380
[0] memory: [1488543156, {"Mem.total"=>1016044, "Mem.used"=>841388, "Mem.free"=>174656, "Swap.total"=>2064380, "Swap.used"=>139888, "Swap.free"=>1924492}]
8481
```
8582

8683
## Example 1 - nest
8784

88-
### Command Line
85+
### Use `nest` from the command line
8986

90-
Using command line mode requires quotes to parse the wildcard properly. The use
91-
of a configuration file is recommended.
87+
Using the command line mode requires quotes to parse the wildcard properly. The use of a configuration file is recommended.
9288

9389
The following command loads the _mem_ plugin. Then the _nest_ filter matches the
9490
wildcard rule to the keys and nests the keys matching `Mem.*` under the new key
@@ -98,7 +94,7 @@ wildcard rule to the keys and nests the keys matching `Mem.*` under the new key
9894
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
9995
```
10096

101-
### Configuration File
97+
### Nest configuration file
10298

10399
{% tabs %}
104100
{% tab title="fluent-bit.conf" %}
@@ -145,7 +141,7 @@ pipeline:
145141
{% endtab %}
146142
{% endtabs %}
147143
148-
### Result
144+
### Nest result
149145
150146
The output of both the command line and configuration invocations should be identical and result in the following output.
151147
@@ -154,12 +150,11 @@ The output of both the command line and configuration invocations should be iden
154150
[0] mem.local: [1522978514.007359767, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "Memstats"=>{"total"=>4050908, "used"=>714984, "free"=>3335924}}]
155151
```
156152
157-
## Example 2 - nest and lift undo
153+
## Example 2 - `nest` and `lift` undo
158154

159-
This example nests all `Mem.*` and `Swap.*` items under the `Stats` key and then
160-
reverses these actions with a `lift` operation. The output appears unchanged.
155+
This example nests all `Mem.*` and `Swap.*` items under the `Stats` key and then reverses these actions with a `lift` operation. The output appears unchanged.
161156

162-
### Example 2 Configuration File
157+
### `nest` and `lift` undo configuration file
163158

164159
{% tabs %}
165160
{% tab title="fluent-bit.conf" %}
@@ -220,19 +215,19 @@ pipeline:
220215
{% endtab %}
221216
{% endtabs %}
222217

223-
### Result
218+
### `nest` and `lift` undo result
224219

225220
```text
226221
[2018/06/21 17:42:37] [ info] [engine] started (pid=17285)
227222
[0] mem.local: [1529566958.000940636, {"Mem.total"=>8053656, "Mem.used"=>6940380, "Mem.free"=>1113276, "Swap.total"=>16532988, "Swap.used"=>1286772, "Swap.free"=>15246216}]
228223
```
229224

230-
## Example 3 - nest 3 levels deep
225+
## Example 3 - `nest` 3 levels deep
231226

232227
This example takes the keys starting with `Mem.*` and nests them under `LAYER1`,
233228
which is then nested under `LAYER2`, which is nested under `LAYER3`.
234229

235-
### Example 3 Configuration File
230+
### Deep `nest` configuration file
236231

237232
{% tabs %}
238233
{% tab title="fluent-bit.conf" %}
@@ -300,7 +295,7 @@ pipeline:
300295
{% endtab %}
301296
{% endtabs %}
302297

303-
### Result
298+
### Deep `nest` Result
304299

305300
```text
306301
[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 +317,11 @@ pipeline:
322317
}
323318
```
324319

325-
## Example 4 - multiple nest and lift filters with prefix
320+
## Example 4 - multiple `nest` and `lift` filters with prefix
326321

327-
This example uses the 3-level deep nesting of _Example 2_ and applies the
328-
`lift` filter three times to reverse the operations. The end result is that all
329-
records are at the top level, without nesting, again. One prefix is added for each
330-
level that's lifted.
322+
This example uses the 3-level deep nesting of Example 2 and applies the `lift` filter three times to reverse the operations. The end result is that all records are at the top level, without nesting, again. One prefix is added for each level that's lifted.
331323

332-
### Configuration file
324+
### `nest` and `lift` prefix configuration file
333325

334326
{% tabs %}
335327
{% tab title="fluent-bit.conf" %}
@@ -434,7 +426,7 @@ pipeline:
434426
{% endtab %}
435427
{% endtabs %}
436428

437-
### Result
429+
### `nest` and `lift` prefix result
438430

439431
```text
440432
[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

Comments
 (0)