Skip to content

Commit 32321b1

Browse files
committed
Upating record-modifier for style
Signed-off-by: Lynette Miles <[email protected]>
1 parent cc6af37 commit 32321b1

File tree

1 file changed

+51
-38
lines changed

1 file changed

+51
-38
lines changed

pipeline/filters/record-modifier.md

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
11
# Record Modifier
22

3-
The _Record Modifier Filter_ plugin allows to append fields or to exclude specific fields.
3+
The _Record Modifier_ filter plugin lets you append fields to a record, or exclude
4+
specific fields.
45

56
## Configuration Parameters
67

7-
The plugin supports the following configuration parameters: _Remove\_key_ and _Allowlist\_key_ are exclusive.
8+
The plugin supports the following configuration parameters. `Remove_key` and
9+
`Allowlist_key` are exclusive.
810

911
| Key | Description |
1012
| :--- | :--- |
11-
| Record | Append fields. This parameter needs key and value pair. |
12-
| Remove\_key | If the key is matched, that field is removed. |
13-
| Allowlist\_key | If the key is **not** matched, that field is removed. |
14-
| Whitelist\_key | An alias of `Allowlist_key` for backwards compatibility. |
15-
| Uuid\_key| If set, the plugin appends uuid to each record. The value assigned becomes the key in the map.|
13+
| `Record` | Append fields. This parameter needs a key/value pair. |
14+
| `Remove_key` | If the key is matched, that field is removed. |
15+
| `Allowlist_key` | If the key isn't matched, that field is removed. |
16+
| `Whitelist_key` | An alias of `Allowlist_key` for backwards compatibility. |
17+
| `Uuid_key`| If set, the plugin appends Uuid to each record. The value assigned becomes the key in the map.|
1618

1719
## Getting Started
1820

19-
In order to start filtering records, you can run the filter from the command line or through the configuration file.
21+
To start filtering records, run the filter from the command line or through a
22+
configuration file.
2023

21-
This is a sample in\_mem record to filter.
24+
This is a sample `in_mem` record to filter.
2225

2326
```text
2427
{"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>299352, "Swap.total"=>2064380, "Swap.used"=>32656, "Swap.free"=>2031724}
2528
```
2629

2730
### Append fields
2831

29-
The following configuration file is to append product name and hostname \(via environment variable\) to record.
32+
The following configuration file appends a product name and hostname to a record
33+
using an environment variable:
3034

3135
{% tabs %}
3236
{% tab title="fluent-bit.conf" %}
33-
```python
37+
38+
```python copy
3439
[INPUT]
3540
Name mem
3641
Tag mem.local
@@ -45,48 +50,50 @@ The following configuration file is to append product name and hostname \(via en
4550
Record hostname ${HOSTNAME}
4651
Record product Awesome_Tool
4752
```
53+
4854
{% endtab %}
4955

5056
{% tab title="fluent-bit.yaml" %}
51-
```yaml
57+
58+
```yaml copy
5259
pipeline:
5360
inputs:
5461
- name: mem
5562
tag: mem.local
5663
filters:
5764
- name: record_modifier
5865
match: '*'
59-
record:
66+
record:
6067
- hostname ${HOSTNAME}
6168
- product Awesome_Tool
6269
outputs:
6370
- name: stdout
6471
match: '*'
6572
```
73+
6674
{% endtab %}
6775
{% endtabs %}
6876
77+
You can run the filter from command line:
6978
70-
You can also run the filter from command line.
71-
72-
```text
73-
$ fluent-bit -i mem -o stdout -F record_modifier -p 'Record=hostname ${HOSTNAME}' -p 'Record=product Awesome_Tool' -m '*'
79+
```shell copy
80+
fluent-bit -i mem -o stdout -F record_modifier -p 'Record=hostname ${HOSTNAME}' -p 'Record=product Awesome_Tool' -m '*'
7481
```
7582

76-
The output will be
83+
The output looks something like:
7784

78-
```python
85+
```python copy
7986
[0] mem.local: [1492436882.000000000, {"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>299352, "Swap.total"=>2064380, "Swap.used"=>32656, "Swap.free"=>2031724, "hostname"=>"localhost.localdomain", "product"=>"Awesome_Tool"}]
8087
```
8188

82-
### Remove fields with Remove\_key
83-
84-
The following configuration file is to remove 'Swap.\*' fields.
89+
### Remove fields with `Remove_key`
8590

91+
The following configuration file removes `Swap.*` fields:
8692

8793
{% tabs %}
8894
{% tab title="fluent-bit.conf" %}
89-
```python
95+
96+
```python copy
9097
[INPUT]
9198
Name mem
9299
Tag mem.local
@@ -102,47 +109,51 @@ The following configuration file is to remove 'Swap.\*' fields.
102109
Remove_key Swap.used
103110
Remove_key Swap.free
104111
```
112+
105113
{% endtab %}
106114

107115
{% tab title="fluent-bit.yaml" %}
108-
```yaml
116+
117+
```yaml copy
109118
pipeline:
110119
inputs:
111120
- name: mem
112121
tag: mem.local
113122
filters:
114123
- name: record_modifier
115124
match: '*'
116-
remove_key:
125+
remove_key:
117126
- Swap.total
118127
- Swap.used
119128
- Swap.free
120129
outputs:
121130
- name: stdout
122131
match: '*'
123132
```
133+
124134
{% endtab %}
125135
{% endtabs %}
126136
127137
You can also run the filter from command line.
128138
129-
```text
130-
$ fluent-bit -i mem -o stdout -F record_modifier -p 'Remove_key=Swap.total' -p 'Remove_key=Swap.free' -p 'Remove_key=Swap.used' -m '*'
139+
```shell copy
140+
fluent-bit -i mem -o stdout -F record_modifier -p 'Remove_key=Swap.total' -p 'Remove_key=Swap.free' -p 'Remove_key=Swap.used' -m '*'
131141
```
132142

133-
The output will be
143+
The output looks something like:
134144

135145
```python
136146
[0] mem.local: [1492436998.000000000, {"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>295332}]
137147
```
138148

139-
### Remove fields with Allowlist\_key
149+
### Remove fields with `Allowlist_key`
140150

141-
The following configuration file is to remain 'Mem.\*' fields.
151+
The following configuration file retains `Mem.*` fields.
142152

143153
{% tabs %}
144154
{% tab title="fluent-bit.conf" %}
145-
```python
155+
156+
```python copy
146157
[INPUT]
147158
Name mem
148159
Tag mem.local
@@ -158,37 +169,39 @@ The following configuration file is to remain 'Mem.\*' fields.
158169
Allowlist_key Mem.used
159170
Allowlist_key Mem.free
160171
```
172+
161173
{% endtab %}
162174

163175
{% tab title="fluent-bit.yaml" %}
164-
```yaml
176+
177+
```yaml copy
165178
pipeline:
166179
inputs:
167180
- name: mem
168181
tag: mem.local
169182
filters:
170183
- name: record_modifier
171184
match: '*'
172-
Allowlist_key:
185+
Allowlist_key:
173186
- Mem.total
174187
- Mem.used
175188
- Mem.free
176189
outputs:
177190
- name: stdout
178191
match: '*'
179192
```
193+
180194
{% endtab %}
181195
{% endtabs %}
182196
183-
You can also run the filter from command line.
197+
You can also run the filter from command line:
184198
185-
```text
186-
$ fluent-bit -i mem -o stdout -F record_modifier -p 'Allowlist_key=Mem.total' -p 'Allowlist_key=Mem.free' -p 'Allowlist_key=Mem.used' -m '*'
199+
```shell copy
200+
fluent-bit -i mem -o stdout -F record_modifier -p 'Allowlist_key=Mem.total' -p 'Allowlist_key=Mem.free' -p 'Allowlist_key=Mem.used' -m '*'
187201
```
188202

189-
The output will be
203+
The output looks something like:
190204

191205
```python
192206
[0] mem.local: [1492436998.000000000, {"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>295332}]
193207
```
194-

0 commit comments

Comments
 (0)