Skip to content

Commit 3bfd06c

Browse files
pipeline: parsers: decoders: general cleanup
Signed-off-by: Alexa Kreizinger <[email protected]>
1 parent bfcfbb2 commit 3bfd06c

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

pipeline/parsers/decoders.md

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Decoders
22

3-
There are cases where the log messages being parsed contain encoded data. A typical
4-
use case can be found in containerized environments with Docker. Docker logs its
5-
data in JSON format, which uses escaped strings.
3+
There are cases where the log messages that you want to parse contain encoded data. A typical use case can be found in containerized environments with Docker. Docker logs its data in JSON format, which uses escaped strings.
64

75
Consider the following message generated by the application:
86

@@ -16,20 +14,18 @@ The Docker log message encapsulates something like this:
1614
{"log":"{\"status\": \"up and running\"}\r\n","stream":"stdout","time":"2018-03-09T01:01:44.851160855Z"}
1715
```
1816

19-
The original message is handled as an escaped string. Fluent Bit wants to use the
20-
original structured message and not a string.
17+
The original message is handled as an escaped string. Fluent Bit wants to use the original structured message and not a string.
2118

22-
## Getting Started
19+
## Get started
2320

24-
Decoders are a built-in feature available through the Parsers file. Each parser
25-
definition can optionally set one or more decoders. There are two types of decoders:
21+
Decoders are a built-in feature available through the `parsers.conf` file. Each parser definition can optionally set one or more decoders. There are two types of decoders:
2622

2723
- `Decode_Field`: If the content can be decoded in a structured message, append
2824
the structured message (keys and values) to the original log message.
2925
- `Decode_Field_As`: Any decoded content (unstructured or structured) will be
3026
replaced in the same key/value, and no extra keys are added.
3127

32-
Our pre-defined Docker parser has the following definition:
28+
For example, the predefined Docker parser has the following definition:
3329

3430
{% tabs %}
3531
{% tab title="parsers.yaml" %}
@@ -64,34 +60,29 @@ parsers:
6460
{% endtab %}
6561
{% endtabs %}
6662

67-
Each line in the parser with a key `Decode_Field` instructs the parser to apply
68-
a specific decoder on a given field. Optionally, it offers the option to take an
69-
extra action if the decoder doesn't succeed.
63+
Each line in the parser with a key `Decode_Field` instructs the parser to apply a specific decoder on a given field. Optionally, it offers the option to take an extra action if the decoder doesn't succeed.
7064

7165
### Decoder options
7266

7367
| Name | Description |
7468
| -------------- | ----------- |
75-
| `json` | Handle the field content as a JSON map. If it finds a JSON map, it replaces the content with a structured map. |
69+
| `json` | Handle the field content as a JSON map. If the decoder finds a JSON map, it replaces the content with a structured map. |
7670
| `escaped` | Decode an escaped string. |
7771
| `escaped_utf8` | Decode a UTF8 escaped string. |
7872

79-
### Optional Actions
73+
### Optional actions
8074

81-
If a decoder fails to decode the field or, you want to try another decoder, you can
82-
define an optional action. Available actions are:
75+
If a decoder fails to decode the field, or if you want to try another decoder, you can define an optional action. Available actions are:
8376

8477
| Name | Description |
8578
| -----| ----------- |
86-
| `try_next` | if the decoder failed, apply the next decoder in the list for the same field. |
87-
| `do_next` | if the decoder succeeded or failed, apply the next decoder in the list for the same field. |
79+
| `try_next` | If the decoder failed, apply the next decoder in the list for the same field. |
80+
| `do_next` | If the decoder succeeded or failed, apply the next decoder in the list for the same field. |
8881

8982
Actions are affected by some restrictions:
9083

91-
- `Decode_Field_As`: If successful, another decoder of the same type and the same
92-
field can be applied only if the data continues being an unstructured message (raw text).
93-
- `Decode_Field`: If successful, can only be applied once for the same field.
94-
`Decode`_Field` is intended to decode a structured message.
84+
- `Decode_Field_As`: If successful, another decoder of the same type and the same field can be applied only if the data continues being an unstructured message (raw text).
85+
- `Decode_Field`: If successful, can only be applied once for the same field. `Decode_Field` is intended to decode a structured message.
9586

9687
### Examples
9788

@@ -124,7 +115,7 @@ Decoder example Fluent Bit configuration files:
124115
```yaml
125116
service:
126117
parsers_file: parsers.yaml
127-
118+
128119
pipeline:
129120
inputs:
130121
- name: tail
@@ -183,4 +174,4 @@ parsers:
183174
```
184175

185176
{% endtab %}
186-
{% endtabs %}
177+
{% endtabs %}

0 commit comments

Comments
 (0)