1
1
# Type Converter
2
2
3
- The _ Type Converter Filter _ plugin allows to convert data type and append new key value pair .
3
+ The _ Type Converter _ filter plugin converts data types and appends new key- value pairs .
4
4
5
5
<img referrerpolicy =" no-referrer-when-downgrade " src =" https://static.scarf.sh/a.png?x-pxid=8984f540-d95a-462b-8a08-09f72f5fab63 " />
6
6
7
- This plugin is useful in combination with plugins which expect incoming string value.
8
- e.g. [ filter_grep] ( grep.md ) , [ filter_modify] ( modify.md )
7
+ You can use this filter in combination with plugins which expect incoming string value. For example, [ Grep] ( grep.md ) and [ Modify] ( modify.md ) .
9
8
10
- ## Configuration Parameters
9
+ ## Configuration parameters
11
10
12
11
The plugin supports the following configuration parameters. It needs four parameters.
13
12
14
- ` <config_parameter> <src_key_name> <dst_key_name> <dst_data_type> `
15
-
16
- _ dst_data_type_ allows ` int ` , ` uint ` , ` float ` and ` string ` .
17
-
18
- e.g. ` int_key id id_str string `
13
+ ``` text
14
+ <config_parameter> <src_key_name> <dst_key_name> <dst_data_type>`
15
+ ```
19
16
17
+ ` dst_data_type ` allows ` int ` , ` uint ` , ` float ` , and ` string ` . For example, ` int_key id id_str string ` .
20
18
21
19
| Key | Description |
22
20
| :--- | :--- |
23
- | int_key | This parameter is for integer source.|
24
- | uint_key | This parameter is for unsigned integer source.|
25
- | float_key| This parameter is for float source.|
26
- | str_key | This parameter is for string source.|
21
+ | ` int_key ` | This parameter is for an integer source.|
22
+ | ` uint_key ` | This parameter is for an unsigned integer source.|
23
+ | ` float_key ` | This parameter is for a float source.|
24
+ | ` str_key ` | This parameter is for a string source.|
27
25
28
- ## Getting Started
26
+ ## Get started
29
27
30
- In order to start filtering records, you can run the filter from the command line or through the configuration file.
28
+ To start filtering records, you can run the filter from the command line or through the configuration file.
31
29
32
- This is a sample in \_ mem record to filter.
30
+ This is a sample ` in_mem ` record to filter.
33
31
34
32
``` text
35
33
{"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>299352, "Swap.total"=>2064380, "Swap.used"=>32656, "Swap.free"=>2031724}
36
34
```
37
35
38
- The plugin outputs uint values and filter_type_converter converts them into string type.
36
+ The plugin outputs ` uint ` values and ` filter_type_converter ` converts them into string type.
39
37
40
- ### Convert uint to string
38
+ ### Convert ` uint ` to string
41
39
42
40
{% tabs %}
43
41
{% tab title="fluent-bit.conf" %}
42
+
44
43
``` python
45
44
[INPUT ]
46
45
Name mem
@@ -56,9 +55,11 @@ The plugin outputs uint values and filter_type_converter converts them into stri
56
55
Name stdout
57
56
Match *
58
57
```
58
+
59
59
{% endtab %}
60
60
61
61
{% tab title="fluent-bit.yaml" %}
62
+
62
63
``` yaml
63
64
pipeline :
64
65
inputs :
@@ -74,13 +75,14 @@ pipeline:
74
75
- name : stdout
75
76
match : ' *'
76
77
` ` `
78
+
77
79
{% endtab %}
78
80
{% endtabs %}
79
81
80
82
You can also run the filter from command line.
81
83
82
- ` ` ` text
83
- $ fluent-bit -i mem -o stdout -F type_converter -p 'uint_key=Mem.total Mem.total_str string' -p 'uint_key=Mem.used Mem.used_str string' -p 'uint_key=Mem.free Mem.free_str string' -m '*'
84
+ ` ` ` shell
85
+ fluent-bit -i mem -o stdout -F type_converter -p 'uint_key=Mem.total Mem.total_str string' -p 'uint_key=Mem.used Mem.used_str string' -p 'uint_key=Mem.free Mem.free_str string' -m '*'
84
86
```
85
87
86
88
The output will be
0 commit comments