Skip to content

Commit ae57c12

Browse files
committed
Pipeline: filters: type-converter: style
Signed-off-by: Lynette Miles <[email protected]>
1 parent 2604a02 commit ae57c12

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

pipeline/filters/type-converter.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
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.
8+
For example, [Grep](grep.md) and [Modify](modify.md).
99

10-
## Configuration Parameters
10+
## Configuration parameters
1111

1212
The plugin supports the following configuration parameters. It needs four parameters.
1313

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

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

2120
| Key | Description |
2221
| :--- | :--- |
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.|
2726

28-
## Getting Started
27+
## Get started
2928

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

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

3433
```text
3534
{"Mem.total"=>1016024, "Mem.used"=>716672, "Mem.free"=>299352, "Swap.total"=>2064380, "Swap.used"=>32656, "Swap.free"=>2031724}
3635
```
3736

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

40-
### Convert uint to string
39+
### Convert `uint` to string
4140

4241
{% tabs %}
4342
{% tab title="fluent-bit.conf" %}
43+
4444
```python
4545
[INPUT]
4646
Name mem
@@ -56,9 +56,11 @@ The plugin outputs uint values and filter_type_converter converts them into stri
5656
Name stdout
5757
Match *
5858
```
59+
5960
{% endtab %}
6061

6162
{% tab title="fluent-bit.yaml" %}
63+
6264
```yaml
6365
pipeline:
6466
inputs:
@@ -74,13 +76,14 @@ pipeline:
7476
- name: stdout
7577
match: '*'
7678
```
79+
7780
{% endtab %}
7881
{% endtabs %}
7982
8083
You can also run the filter from command line.
8184
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 '*'
8487
```
8588

8689
The output will be

0 commit comments

Comments
 (0)