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.
8
+ For example, [ Grep ] ( grep.md ) and [ Modify ] ( modify.md ) .
9
9
10
- ## Configuration Parameters
10
+ ## Configuration parameters
11
11
12
12
The plugin supports the following configuration parameters. It needs four parameters.
13
13
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 `
14
+ ``` text
15
+ <config_parameter> <src_key_name> <dst_key_name> <dst_data_type>`
16
+ ```
19
17
18
+ ` dst_data_type ` allows ` int ` , ` uint ` , ` float ` , and ` string ` . For example, ` int_key id id_str string ` .
20
19
21
20
| Key | Description |
22
21
| :--- | :--- |
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.|
22
+ | ` int_key ` | This parameter is for an integer source.|
23
+ | ` uint_key ` | This parameter is for an unsigned integer source.|
24
+ | ` float_key ` | This parameter is for a float source.|
25
+ | ` str_key ` | This parameter is for a string source.|
27
26
28
- ## Getting Started
27
+ ## Get started
29
28
30
- In order to start filtering records, you can run the filter from the command line or through the configuration file.
29
+ To start filtering records, you can run the filter from the command line or through the configuration file.
31
30
32
- This is a sample in \_ mem record to filter.
31
+ This is a sample ` in_mem ` record to filter.
33
32
34
33
``` text
35
34
{"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>299352, "Swap.total"=>2064380, "Swap.used"=>32656, "Swap.free"=>2031724}
36
35
```
37
36
38
- The plugin outputs uint values and filter_type_converter converts them into string type.
37
+ The plugin outputs ` uint ` values and ` filter_type_converter ` converts them into string type.
39
38
40
- ### Convert uint to string
39
+ ### Convert ` uint ` to string
41
40
42
41
{% tabs %}
43
42
{% tab title="fluent-bit.conf" %}
43
+
44
44
``` python
45
45
[INPUT ]
46
46
Name mem
@@ -56,9 +56,11 @@ The plugin outputs uint values and filter_type_converter converts them into stri
56
56
Name stdout
57
57
Match *
58
58
```
59
+
59
60
{% endtab %}
60
61
61
62
{% tab title="fluent-bit.yaml" %}
63
+
62
64
``` yaml
63
65
pipeline :
64
66
inputs :
@@ -74,13 +76,14 @@ pipeline:
74
76
- name : stdout
75
77
match : ' *'
76
78
` ` `
79
+
77
80
{% endtab %}
78
81
{% endtabs %}
79
82
80
83
You can also run the filter from command line.
81
84
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 '*'
85
+ ` ` ` shell
86
+ 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
87
```
85
88
86
89
The output will be
0 commit comments