Skip to content

Commit ffc6bfd

Browse files
consolidate multiline parsers info
Signed-off-by: Alexa Kreizinger <alexakreizinger@gmail.com>
1 parent f9803d3 commit ffc6bfd

File tree

6 files changed

+36
-21
lines changed

6 files changed

+36
-21
lines changed

.gitbook.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,4 @@ redirects:
102102
installation/downloads/amazon-ec2: ./installation/downloads/linux/amazon-linux.md
103103
administration/configuring-fluent-bit/yaml/configuration-file: ./administration/configuring-fluent-bit/yaml.md
104104
administration/configuring-fluent-bit/unit-sizes: ./administration/configuring-fluent-bit.md#unit-sizes
105+
administration/configuring-fluent-bit/multiline-parsing: ./pipeline/parsers/multiline-parsing.md

SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
* [Record accessor syntax](administration/configuring-fluent-bit/classic-mode/record-accessor.md)
5555
* [Upstream servers](administration/configuring-fluent-bit/classic-mode/upstream-servers.md)
5656
* [Variables](administration/configuring-fluent-bit/classic-mode/variables.md)
57-
* [Multiline parsing](administration/configuring-fluent-bit/multiline-parsing.md)
5857
* [AWS credentials](administration/aws-credentials.md)
5958
* [Backpressure](administration/backpressure.md)
6059
* [Buffering and storage](administration/buffering-and-storage.md)
@@ -126,6 +125,7 @@
126125
* [Windows System Statistics (winstat)](pipeline/inputs/windows-system-statistics.md)
127126
* [Parsers](pipeline/parsers.md)
128127
* [Configuring custom parsers](pipeline/parsers/configuring-parser.md)
128+
* [Multiline parsing](pipeline/parsers/multiline-parsing.md)
129129
* [JSON format](pipeline/parsers/json.md)
130130
* [Logfmt format](pipeline/parsers/logfmt.md)
131131
* [LTSV format](pipeline/parsers/ltsv.md)

administration/configuring-fluent-bit/yaml/multiline-parsers-section.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# Multiline parsers
22

3-
Multiline parsers are used to combine logs that span multiple events into a single, cohesive message. Use this parser for handling stack traces, error logs, or any log entry that contains multiple lines of information.
3+
You can define custom [multiline parsers](../pipeline/parsers/multiline-parsing.md) in the `multiline_parsers` section of YAML configuration files.
44

5-
In YAML configuration, the syntax for defining multiline parsers differs slightly from the classic configuration format introducing minor breaking changes, specifically on how the rules are defined.
5+
{% hint style="info" %}
66

7-
The following example demonstrates how to define a multiline parser directly in the main configuration file, and how to include additional definitions from external files:
7+
To define standard custom parsers, use [the `parsers` section](../administration/configuring-fluent-bit/yaml/parsers-section.md) of YAML configuration files.
8+
9+
{% endhint %}
10+
11+
## Syntax
12+
13+
To define customers parsers in the `multiline_parsers` section of a YAML configuration file, use the following syntax:
14+
15+
{% tabs %}
16+
{% tab title="fluent-bit.yaml" %}
817

918
```yaml
1019
multiline_parsers:
@@ -20,6 +29,9 @@ multiline_parsers:
2029
next_state: cont
2130
```
2231
32+
{% endtab %}
33+
{% endtabs %}
34+
2335
This example defines a multiline parser named `multiline-regex-test` that uses regular expressions to handle multi-event logs. The parser contains two rules: the first rule transitions from `start_state` to cont when a matching log entry is detected, and the second rule continues to match subsequent lines.
2436

25-
For more detailed information on configuring multiline parsers, including advanced options and use cases, refer to the Configuring Multiline Parsers documentation.
37+
For information about supported configuration options for custom multiline parsers, see [configuring multiline parsers](./pipeline/parsers/multiline-parsing.md#configuring-multiline-parsers).

pipeline/filters/multiline-stacktrace.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Along with multiline filters, you can enable one of the following built-in Fluen
1515

1616
When using this filter:
1717

18-
- The usage of this filter depends on a previous configuration of a [multiline parser](../../administration/configuring-fluent-bit/multiline-parsing.md) definition.
18+
- The usage of this filter depends on a previous configuration of a [multiline parser](../pipeline/parsers/multiline-parsing.md) definition.
1919
- To concatenate messages read from a log file, it's highly recommended to use the multiline support in the [Tail plugin](https://docs.fluentbit.io/manual/pipeline/inputs/tail#multiline-support) itself. This is because performing concatenation while reading the log file is more performant. Concatenating messages that were originally one line, but split by Docker or CRI container engines because of their size, is supported in the [Tail plugin](https://docs.fluentbit.io/manual/pipeline/inputs/tail#multiline-support) in combination with the `docker` or `cri` parser. To concatenate application logs like stacktraces on top of that, you can use this multiline filter.
2020

2121
{% hint style="warning" %}
@@ -40,7 +40,7 @@ The plugin supports the following configuration parameters:
4040

4141
| Property | Description |
4242
| -------- | ----------- |
43-
| `multiline.parser` | Specify one or multiple [Multiline Parser definitions](../../administration/configuring-fluent-bit/multiline-parsing.md) to apply to the content. You can specify multiple multiline parsers to detect different formats by separating them with a comma. |
43+
| `multiline.parser` | Specify one or multiple [Multiline Parser definitions](../pipeline/parsers/multiline-parsing.md) to apply to the content. You can specify multiple multiline parsers to detect different formats by separating them with a comma. |
4444
| `multiline.key_content` | Key name that holds the content to process. A multiline parser definition can specify the `key_content` This option allows for overwriting that value for the purpose of the filter. |
4545
| `mode` | Mode can be `parser` for regular expression concatenation, or `partial_message` to concatenate split Docker logs. |
4646
| `buffer` | Enable buffered mode. In buffered mode, the filter can concatenate multiple lines from inputs that ingest records one by one (like Forward), rather than in chunks, re-emitting them into the beginning of the pipeline (with the same tag) using the `in_emitter` instance. With buffer off, this filter won't work with most inputs, except Tail. |
@@ -68,7 +68,7 @@ service:
6868
flush: 1
6969
log_level: info
7070
parsers_file: parsers_multiline.yaml
71-
71+
7272
pipeline:
7373
inputs:
7474
- name: tail
@@ -157,10 +157,10 @@ This file defines a multiline parser for the example. A second multiline parser
157157
# Regex rules for multiline parsing
158158
# ---------------------------------
159159
#
160-
# configuration hints:
160+
# configuration hints:
161161
#
162162
# - first state always has the name: start_state
163-
# - every field in the rule must be inside double quotes
163+
# - every field in the rule must be inside double quotes
164164
#
165165
# rules | state name | regex pattern | next state
166166
# ------|---------------|--------------------------------------------
@@ -314,7 +314,7 @@ Lines that don't match a pattern aren't considered as part of the multiline mess
314314

315315
## Docker partial message use case
316316

317-
When Fluent Bit is consuming logs from a container runtime, such as Docker, these logs will be split when larger than a certain limit, usually 16&nbspKB.
317+
When Fluent Bit is consuming logs from a container runtime, such as Docker, these logs will be split when larger than a certain limit, usually 16&nbspKB.
318318
If your application emits a 100K log line, it will be split into seven partial messages. The docker parser will merge these back to one line. If instead you are using the [Fluentd Docker Log Driver](https://docs.docker.com/config/containers/logging/fluentd/) to send the logs to Fluent Bit, they might look like this:
319319

320320
```text

pipeline/inputs/tail.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ Multiline core is exposed by the following configuration:
158158

159159
| Key | Description |
160160
|:-------------------|:---------------|
161-
| `multiline.parser` | Specify one or multiple [Multiline Parser definitions](../../administration/configuring-fluent-bit/multiline-parsing.md) to apply to the content. |
161+
| `multiline.parser` | Specify one or multiple [Multiline Parser definitions](../pipeline/parsers/multiline-parsing.md) to apply to the content. |
162162

163-
[Multiline Parser](../../administration/configuring-fluent-bit/multiline-parsing.md) provides built-in configuration modes. When using a new `multiline.parser` definition, you must disable the old configuration from your tail section like:
163+
[Multiline Parser](../pipeline/parsers/multiline-parsing.md) provides built-in configuration modes. When using a new `multiline.parser` definition, you must disable the old configuration from your tail section like:
164164

165165
- `parser`
166166
- `parser_firstline`

administration/configuring-fluent-bit/multiline-parsing.md renamed to pipeline/parsers/multiline-parsing.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
In an ideal world, applications might log their messages within a single line, but in reality applications generate multiple log messages that sometimes belong to the same context. Processing this information can be complex, like in application stack traces, which always have multiple log lines.
66

7-
Fluent Bit v1.8 implemented a unified Multiline core capability to solve corner cases.
7+
Multiline parsers are used to combine logs that span multiple events into a single, cohesive message. Use this parser for handling stack traces, error logs, or any log entry that contains multiple lines of information.
88

99
## Concepts
1010

11-
The Multiline parser engine exposes two ways to configure and use the feature:
11+
The multiline parser engine exposes two ways to configure and use the feature:
1212

1313
- Built-in multiline parser
1414
- Configurable multiline parser
@@ -26,13 +26,15 @@ Fluent Bit exposes certain pre-configured parsers (built-in) to solve specific m
2626
| `python` | Process log entries generated by a Python-based language application and perform concatenation if multiline messages are detected. |
2727
| `ruby` | Process log entries generated by a Ruby-based language application and perform concatenation if multiline messages are detected. |
2828

29-
### Configurable multiline parsers
29+
### Configuring multiline parsers
3030

31-
You can define your own Multiline parsers with their own rules, using a configuration file.
31+
Custom multiline parsers support the following configuration parameters.
3232

33-
A multiline parser is defined in a `parsers configuration file` by using a `[MULTILINE_PARSER]` section definition. The multiline parser must have a unique name and a type, plus other configured properties associated with each type.
33+
{% hint style="info" %}
34+
35+
To define a custom multiline parser, add an entry to the [`multiline_parsers` section](../configuring-fluent-bit/yaml/multiline-parsers-section.md) of your YAML configuration file.
3436

35-
To understand which multiline parser type is required for your use case you have to know the conditions in the content that determine the beginning of a multiline message, and the continuation of subsequent lines. Fluent Bit provides a regular expression-based configuration that supports states to handle from the most cases.
37+
{% endhint %}
3638

3739
| Property | Description | Default |
3840
| -------- | ----------- | ------- |
@@ -43,7 +45,7 @@ To understand which multiline parser type is required for your use case you have
4345
| `negate` | Negate the pattern matching result. When set to `true`, a non-matching line is treated as matching. | `false` |
4446
| `parser` | Name of a pre-defined parser that must be applied to the incoming content before applying the regular expression rule. If no parser is defined, it's assumed that's a raw text and not a structured message. When a parser is applied to a raw text, the regular expression is applied against a specific key of the structured message by using the `key_content` configuration property. | _none_ |
4547
| `rule` | Configure a rule to match a multiline pattern. The rule has a [specific format](#rules-definition). Multiple rules can be defined. Only used with `regex` type. | _none_|
46-
| `type` | Set the multiline mode. Fluent Bit supports `regex`, `endswith`, and `equal` (or `eq`). | _none_ |
48+
| `type` | Set the multiline mode. Fluent Bit supports `regex`, `endswith`, and `equal` (or `eq`). To understand which multiline parser type is required for your use case you have to know the conditions in the content that determine the beginning of a multiline message, and the continuation of subsequent lines. Fluent Bit provides a regular expression-based configuration that supports states to handle from the most cases. | _none_ |
4749

4850
#### Lines and states
4951

@@ -836,4 +838,4 @@ app/models/user.rb:42:in `validate_email'
836838
```
837839

838840
{% endtab %}
839-
{% endtabs %}
841+
{% endtabs %}

0 commit comments

Comments
 (0)