1
1
# Record Modifier
2
2
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.
4
5
5
6
## Configuration Parameters
6
7
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.
8
10
9
11
| Key | Description |
10
12
| :--- | :--- |
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.|
16
18
17
19
## Getting Started
18
20
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.
20
23
21
- This is a sample in \_ mem record to filter.
24
+ This is a sample ` in_mem ` record to filter.
22
25
23
26
``` text
24
27
{"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>299352, "Swap.total"=>2064380, "Swap.used"=>32656, "Swap.free"=>2031724}
25
28
```
26
29
27
30
### Append fields
28
31
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:
30
34
31
35
{% tabs %}
32
36
{% tab title="fluent-bit.conf" %}
33
- ``` python
37
+
38
+ ``` python copy
34
39
[INPUT ]
35
40
Name mem
36
41
Tag mem.local
@@ -45,48 +50,50 @@ The following configuration file is to append product name and hostname \(via en
45
50
Record hostname $ {HOSTNAME }
46
51
Record product Awesome_Tool
47
52
```
53
+
48
54
{% endtab %}
49
55
50
56
{% tab title="fluent-bit.yaml" %}
51
- ``` yaml
57
+
58
+ ``` yaml copy
52
59
pipeline :
53
60
inputs :
54
61
- name : mem
55
62
tag : mem.local
56
63
filters :
57
64
- name : record_modifier
58
65
match : ' *'
59
- record :
66
+ record :
60
67
- hostname ${HOSTNAME}
61
68
- product Awesome_Tool
62
69
outputs :
63
70
- name : stdout
64
71
match : ' *'
65
72
` ` `
73
+
66
74
{% endtab %}
67
75
{% endtabs %}
68
76
77
+ You can run the filter from command line:
69
78
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 '*'
74
81
```
75
82
76
- The output will be
83
+ The output looks something like:
77
84
78
- ``` python
85
+ ``` python copy
79
86
[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" }]
80
87
```
81
88
82
- ### Remove fields with Remove\_ key
83
-
84
- The following configuration file is to remove 'Swap.\* ' fields.
89
+ ### Remove fields with ` Remove_key `
85
90
91
+ The following configuration file removes ` Swap.* ` fields:
86
92
87
93
{% tabs %}
88
94
{% tab title="fluent-bit.conf" %}
89
- ``` python
95
+
96
+ ``` python copy
90
97
[INPUT ]
91
98
Name mem
92
99
Tag mem.local
@@ -102,47 +109,51 @@ The following configuration file is to remove 'Swap.\*' fields.
102
109
Remove_key Swap.used
103
110
Remove_key Swap.free
104
111
```
112
+
105
113
{% endtab %}
106
114
107
115
{% tab title="fluent-bit.yaml" %}
108
- ``` yaml
116
+
117
+ ``` yaml copy
109
118
pipeline :
110
119
inputs :
111
120
- name : mem
112
121
tag : mem.local
113
122
filters :
114
123
- name : record_modifier
115
124
match : ' *'
116
- remove_key :
125
+ remove_key :
117
126
- Swap.total
118
127
- Swap.used
119
128
- Swap.free
120
129
outputs :
121
130
- name : stdout
122
131
match : ' *'
123
132
` ` `
133
+
124
134
{% endtab %}
125
135
{% endtabs %}
126
136
127
137
You can also run the filter from command line.
128
138
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 '*'
131
141
```
132
142
133
- The output will be
143
+ The output looks something like:
134
144
135
145
``` python
136
146
[0 ] mem.local: [1492436998.000000000 , {" Mem.total" => 1016024 , " Mem.used" => 716672 , " Mem.free" => 295332 }]
137
147
```
138
148
139
- ### Remove fields with Allowlist \_ key
149
+ ### Remove fields with ` Allowlist_key `
140
150
141
- The following configuration file is to remain ' Mem.\* ' fields.
151
+ The following configuration file retains ` Mem.* ` fields.
142
152
143
153
{% tabs %}
144
154
{% tab title="fluent-bit.conf" %}
145
- ``` python
155
+
156
+ ``` python copy
146
157
[INPUT ]
147
158
Name mem
148
159
Tag mem.local
@@ -158,37 +169,39 @@ The following configuration file is to remain 'Mem.\*' fields.
158
169
Allowlist_key Mem.used
159
170
Allowlist_key Mem.free
160
171
```
172
+
161
173
{% endtab %}
162
174
163
175
{% tab title="fluent-bit.yaml" %}
164
- ``` yaml
176
+
177
+ ``` yaml copy
165
178
pipeline :
166
179
inputs :
167
180
- name : mem
168
181
tag : mem.local
169
182
filters :
170
183
- name : record_modifier
171
184
match : ' *'
172
- Allowlist_key :
185
+ Allowlist_key :
173
186
- Mem.total
174
187
- Mem.used
175
188
- Mem.free
176
189
outputs :
177
190
- name : stdout
178
191
match : ' *'
179
192
` ` `
193
+
180
194
{% endtab %}
181
195
{% endtabs %}
182
196
183
- You can also run the filter from command line.
197
+ You can also run the filter from command line:
184
198
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 '*'
187
201
```
188
202
189
- The output will be
203
+ The output looks something like:
190
204
191
205
``` python
192
206
[0 ] mem.local: [1492436998.000000000 , {" Mem.total" => 1016024 , " Mem.used" => 716672 , " Mem.free" => 295332 }]
193
207
```
194
-
0 commit comments