You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example defines two rules. Each rule has its own state name, regex patterns, and the next state name. Every field that composes a rule must be inside double quotes.
85
106
86
107
The first rule of a state name must be `start_state`. The regex pattern must match the first line of a multiline message, and a next state must be set to specify what the possible continuation lines look like.
@@ -91,19 +112,42 @@ To simplify the configuration of regular expressions, you can use the [Rubular](
91
112
92
113
#### Configuration example
93
114
94
-
The following example provides a full Fluent Bit configuration file for multiline parsing by using the definition explained previously.
115
+
The following example provides a full Fluent Bit configuration file for multiline parsing by using the definition
116
+
explained previously. It is provided in corresponding YAML and classic configuration examples below:
95
117
96
-
{% hint style="info" %}
97
-
The following example files can be located [at this link](https://github.com/fluent/fluent-bit/tree/master/documentation/examples/multiline/regex-001).
98
-
{% endhint %}
118
+
{% tabs %}
99
119
100
-
Example files content:
120
+
{% tab title="fluent-bit.yaml" %}
121
+
122
+
This is the primary Fluent Bit YAML configuration file. It includes the `parsers_multiline.yaml` and tails the file `test.log`
123
+
by applying the multiline parser `multiline-regex-test`. Then it sends the processing to the standard output.
124
+
125
+
```yaml
126
+
service:
127
+
flush: 1
128
+
log_level: info
129
+
parsers_file: parsers_multiline.yaml
130
+
131
+
pipeline:
132
+
inputs:
133
+
- name: tail
134
+
path: test.log
135
+
read_from_head: true
136
+
multiline.parser: multiline-regex-test
137
+
138
+
outputs:
139
+
- name: stdout
140
+
match: '*'
141
+
```
142
+
143
+
{% endtab %}
101
144
102
-
{% tabs %}
103
145
{% tab title="fluent-bit.conf" %}
104
-
This is the primary Fluent Bit configuration file. It includes the `parsers_multiline.conf` and tails the file `test.log` by applying the multiline parser `multiline-regex-test`. Then it sends the processing to the standard output.
105
146
106
-
```python
147
+
This is the primary Fluent Bit classic configuration file. It includes the `parsers_multiline.conf` and tails the file `test.log`
148
+
by applying the multiline parser `multiline-regex-test`. Then it sends the processing to the standard output.
149
+
150
+
```text
107
151
[SERVICE]
108
152
flush 1
109
153
log_level info
@@ -120,12 +164,44 @@ This is the primary Fluent Bit configuration file. It includes the `parsers_mult
120
164
match *
121
165
```
122
166
167
+
{% endtab %}
168
+
169
+
{% tab title="parsers_multiline.yaml" %}
170
+
171
+
This file defines a multiline parser for the YAML configuration example.
172
+
173
+
```yaml
174
+
multiline_parsers:
175
+
- name: multiline-regex-test
176
+
type: regex
177
+
flush_timeout: 1000
178
+
#
179
+
# Regex rules for multiline parsing
180
+
# ---------------------------------
181
+
#
182
+
# configuration hints:
183
+
#
184
+
# - first state always has the name: start_state
185
+
# - every field in the rule must be inside double quotes
The lines that didn't match a pattern aren't considered as part of the multiline message, while the ones that matched the rules were concatenated properly.
@@ -201,11 +282,47 @@ The following example retrieves `date` and `message` from concatenated logs.
201
282
202
283
Example files content:
203
284
204
-
{% tabs %}
285
+
% tabs %}
286
+
287
+
{% tab title="fluent-bit.yaml" %}
288
+
289
+
This is the primary Fluent Bit YAML configuration file. It includes the `parsers_multiline.conf` and tails the file `test.log`
290
+
by applying the multiline parser `multiline-regex-test`. It also parses concatenated log by applying parser `named-capture-test`.
291
+
Then it sends the processing to the standard output.
292
+
293
+
```yaml
294
+
service:
295
+
flush: 1
296
+
log_level: info
297
+
parsers_file: parsers_multiline.yaml
298
+
299
+
pipeline:
300
+
inputs:
301
+
- name: tail
302
+
path: test.log
303
+
read_from_head: true
304
+
multiline.parser: multiline-regex-test
305
+
306
+
filters:
307
+
- name: parser
308
+
match: '*'
309
+
key_name: log
310
+
parser: named-capture-test
311
+
312
+
outputs:
313
+
- name: stdout
314
+
match: '*'
315
+
```
316
+
317
+
{% endtab %}
318
+
205
319
{% tab title="fluent-bit.conf" %}
206
-
This is the primary Fluent Bit configuration file. It includes the `parsers_multiline.conf` and tails the file `test.log` by applying the multiline parser `multiline-regex-test`. It also parses concatenated log by applying parser `named-capture-test`. Then it sends the processing to the standard output.
207
320
208
-
```python
321
+
This is the primary Fluent Bit classic configuration file. It includes the `parsers_multiline.conf` and tails the file
322
+
`test.log`by applying the multiline parser `multiline-regex-test`. It also parses concatenated log by applying parser
323
+
`named-capture-test`. Then it sends the processing to the standard output.
324
+
325
+
```text
209
326
[SERVICE]
210
327
flush 1
211
328
log_level info
@@ -230,10 +347,47 @@ This is the primary Fluent Bit configuration file. It includes the `parsers_mult
230
347
231
348
{% endtab %}
232
349
350
+
{% tab title="parsers_multiline.yaml" %}
351
+
352
+
This file defines a multiline parser for the YAML example.
353
+
354
+
```yaml
355
+
multiline_parsers:
356
+
- name: multiline-regex-test
357
+
type: regex
358
+
flush_timeout: 1000
359
+
#
360
+
# Regex rules for multiline parsing
361
+
# ---------------------------------
362
+
#
363
+
# configuration hints:
364
+
#
365
+
# - first state always has the name: start_state
366
+
# - every field in the rule must be inside double quotes
0 commit comments