Skip to content

Commit 73164be

Browse files
authored
Merge pull request #1702 from fluent/lynettemiles/sc-136164/update-fluent-bit-docs-pipeline-filters-type
2 parents 9938772 + 3252dd0 commit 73164be

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

pipeline/filters/type-converter.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,45 @@
11
# Type Converter
22

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

55
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=8984f540-d95a-462b-8a08-09f72f5fab63" />
66

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).
98

10-
## Configuration Parameters
9+
## Configuration parameters
1110

1211
The plugin supports the following configuration parameters. It needs four parameters.
1312

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+
```
1916

17+
`dst_data_type` allows `int`, `uint`, `float`, and `string`. For example, `int_key id id_str string`.
2018

2119
| Key | Description |
2220
| :--- | :--- |
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.|
2725

28-
## Getting Started
26+
## Get started
2927

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

32-
This is a sample in\_mem record to filter.
30+
This is a sample `in_mem` record to filter.
3331

3432
```text
3533
{"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>299352, "Swap.total"=>2064380, "Swap.used"=>32656, "Swap.free"=>2031724}
3634
```
3735

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

40-
### Convert uint to string
38+
### Convert `uint` to string
4139

4240
{% tabs %}
4341
{% tab title="fluent-bit.conf" %}
42+
4443
```python
4544
[INPUT]
4645
Name mem
@@ -56,9 +55,11 @@ The plugin outputs uint values and filter_type_converter converts them into stri
5655
Name stdout
5756
Match *
5857
```
58+
5959
{% endtab %}
6060

6161
{% tab title="fluent-bit.yaml" %}
62+
6263
```yaml
6364
pipeline:
6465
inputs:
@@ -74,13 +75,14 @@ pipeline:
7475
- name: stdout
7576
match: '*'
7677
```
78+
7779
{% endtab %}
7880
{% endtabs %}
7981
8082
You can also run the filter from command line.
8183
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 '*'
8486
```
8587

8688
The output will be

0 commit comments

Comments
 (0)