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
@@ -56,26 +56,40 @@ Replace _`LIMIT1`_ and _`LIMIT2`_ with the integer values of your choosing. High
56
56
However, these changes revert upon reboot unless you write them to the appropriate `inotify.conf` file, in which case they will persist across reboots. The specific name of this file might vary depending on how you built and installed Fluent Bit. For example, to write changes to a file named `fluent-bit_fs_inotify.conf`, run the following commands:
Replace _`LIMIT1`_ and _`LIMIT2`_ with the integer values of your choosing.
65
65
66
-
You can also provide a custom systemd configuration file that overrides the default systemd settings for Fluent Bit. This override file must be located at `/etc/systemd/system/fluent-bit.service.d/override.conf`. For example, you can add this snippet to your override file to raise the number of files that the Tail plugin can monitor:
66
+
You can also provide a custom systemd configuration file that overrides the default systemd settings for Fluent Bit. This override file must be located at `/etc/systemd/system/fluent-bit.service.d/override.conf` or `/etc/systemd/system/fluent-bit.service.d/override.yaml` depending
67
+
on the configuration you choose. For example, you can add one of these snippets to your override file to raise the number of files that the Tail plugin can monitor:
68
+
{% tabs %}
69
+
{% tab title="override.yaml" %}
70
+
71
+
```yaml
72
+
service:
73
+
limitnofile: LIMIT
74
+
```
75
+
76
+
{% endtab %}
77
+
{% tab title="override.conf" %}
67
78
68
79
```text
69
80
[Service]
70
81
LimitNOFILE=LIMIT
71
82
```
72
83
84
+
{% endtab %}
85
+
{% endtabs %}
86
+
73
87
Replace _`LIMIT`_ with the integer value of your choosing.
74
88
75
89
If you don't already have an override file, you can use the following command to create one in the correct directory:
76
90
77
-
```shell copy
78
-
systemctl edit fluent-bit.service
91
+
```shell
92
+
$ systemctl edit fluent-bit.service
79
93
```
80
94
81
95
## Multiline Support
@@ -107,23 +121,26 @@ As stated in the [Multiline Parser documentation](../../administration/configuri
107
121
If you are running Fluent Bit to process logs coming from containers like Docker or CRI, you can use the new built-in modes for such purposes. This will help to reassembly multiline messages originally split by Docker or CRI:
108
122
109
123
{% tabs %}
124
+
{% tab title="fluent-bit.yaml" %}
125
+
126
+
```yaml
127
+
pipeline:
128
+
inputs:
129
+
- name: tail
130
+
path: /var/log/containers/*.log
131
+
multiline.parser: docker, cri
132
+
```
133
+
134
+
{% endtab %}
110
135
{% tab title="fluent-bit.conf" %}
136
+
111
137
```text
112
138
[INPUT]
113
139
name tail
114
140
path /var/log/containers/*.log
115
141
multiline.parser docker, cri
116
142
```
117
-
{% endtab %}
118
143
119
-
{% tab title="fluent-bit.yaml" %}
120
-
```yaml
121
-
pipeline:
122
-
inputs:
123
-
- name: tail
124
-
path: /var/log/containers/*.log
125
-
multiline.parser: docker, cri
126
-
```
127
144
{% endtab %}
128
145
{% endtabs %}
129
146
@@ -164,16 +181,31 @@ In order to tail text or log files, you can run the plugin from the command line
164
181
165
182
From the command line you can let Fluent Bit parse text files with the following options:
In your main configuration file, append the following `Input` and `Output` sections:
190
+
Append the following in your main configuration file:
174
191
175
192
{% tabs %}
193
+
{% tab title="fluent-bit.yaml" %}
194
+
195
+
```yaml
196
+
pipeline:
197
+
inputs:
198
+
- name: tail
199
+
path: /var/log/syslog
200
+
201
+
outputs:
202
+
- stdout:
203
+
match: *
204
+
```
205
+
206
+
{% endtab %}
176
207
{% tab title="fluent-bit.conf" %}
208
+
177
209
```text
178
210
[INPUT]
179
211
Name tail
@@ -183,24 +215,10 @@ In your main configuration file, append the following `Input` and `Output` secti
183
215
Name stdout
184
216
Match *
185
217
```
186
-
{% endtab %}
187
-
188
-
{% tab title="fluent-bit.yaml" %}
189
-
```yaml
190
-
pipeline:
191
-
inputs:
192
-
- name: tail
193
-
path: /var/log/syslog
194
218
195
-
outputs:
196
-
- stdout:
197
-
match: *
198
-
```
199
219
{% endtab %}
200
220
{% endtabs %}
201
221
202
-

203
-
204
222
### Old Multi-line example
205
223
206
224
When using multi-line configuration you need to first specify `Multiline On` in the configuration and use the `Parser_Firstline` and additional parser parameters `Parser_N` if needed. If we are trying to read the following Java Stacktrace as a single event
@@ -220,7 +238,20 @@ In the case above we can use the following parser, that extracts the Time as `ti
If we want to further parse the entire event we can add additional parsers with `Parser_N` where N is an integer. The final Fluent Bit configuration looks like the following:
@@ -306,7 +330,7 @@ Our output will be as follows.
306
330
307
331
The _tail_ input plugin a feature to save the state of the tracked files, is strongly suggested you enabled this. For this purpose the **db** property is available, e.g:
@@ -344,23 +368,26 @@ Fluent Bit keep the state or checkpoint of each file through using a SQLite data
344
368
The SQLite journaling mode enabled is `Write Ahead Log` or `WAL`. This allows to improve performance of read and write operations to disk. When enabled, you will see in your file system additional files being created, consider the following configuration statement:
345
369
346
370
{% tabs %}
371
+
{% tab title="fluent-bit.yaml" %}
372
+
373
+
```yaml
374
+
pipeline:
375
+
inputs:
376
+
- name: tail
377
+
path: /var/log/containers/*.log
378
+
db: test.db
379
+
```
380
+
381
+
{% endtab %}
347
382
{% tab title="fluent-bit.conf" %}
383
+
348
384
```text
349
385
[INPUT]
350
386
name tail
351
387
path /var/log/containers/*.log
352
388
db test.db
353
389
```
354
-
{% endtab %}
355
390
356
-
{% tab title="fluent-bit.yaml" %}
357
-
```yaml
358
-
pipeline:
359
-
inputs:
360
-
- name: tail
361
-
path: /var/log/containers/*.log
362
-
db: test.db
363
-
```
364
391
{% endtab %}
365
392
{% endtabs %}
366
393
@@ -379,4 +406,13 @@ The `WAL` mechanism give us higher performance but also might increase the memor
379
406
380
407
File rotation is properly handled, including logrotate's _copytruncate_ mode.
381
408
382
-
Note that the `Path` patterns **cannot** match the rotated files. Otherwise, the rotated file would be read again and lead to duplicate records.
409
+
{% hint style="warning" %}
410
+
411
+
Note that while file rotation is handled, there are risks of potential log loss when using `logrotate` with `copytruncate` mode:
412
+
413
+
- race conditions: logs can be lost in the brief window between copying and truncating the file.
414
+
- backpressure: if Fluent Bit is under backpressure, logs might be dropped if `copyttruncate` occurs before they can be processed and sent.
415
+
- see `logroate man page`: "Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost."
416
+
- final note: the `Path` patterns **cannot** match the rotated files. Otherwise, the rotated file would be read again and lead to duplicate records.
0 commit comments