Skip to content

Commit 19afe22

Browse files
committed
in_tail: Add generic.encoding parameter descriptions
Also I added the reason why we need to support these parameters and how to use them. Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 162cbd9 commit 19afe22

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

pipeline/inputs/tail.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The plugin supports the following configuration parameters:
3838
| `File_Cache_Advise` | Set the `posix_fadvise` in `POSIX_FADV_DONTNEED` mode. This reduces the usage of the kernel file cache. This option is ignored if not running on Linux. | `On` |
3939
| `Threaded` | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). | `false` |
4040
| `Unicode.Encoding` | Set the Unicode character encoding of the file data. This parameter requests two-byte aligned chunk and buffer sizes. If data is not aligned for two bytes, Fluent Bit will use two-byte alignment automatically to avoid character breakages on consuming boundaries. Supported values: `UTF-16LE`, `UTF-16BE`, and `auto`. | _none_ |
41+
| `Generic.Encoding` | Set the encoding which the origin of character encoding. Currently, ShiftJIS, UHC, GBK, GB18030, Big5, Win866, Win874, Win1250, Win1251, Win1252, Win2513, Win1254, Win1255, Win1256 are supported. | _none_ |
4142

4243
{% hint style="info" %}
4344
If the database parameter `DB` isn't specified, by default the plugin reads each target file from the beginning. This might cause unwanted behavior. For example, when a line is bigger than `Buffer_Chunk_Size` and `Skip_Long_Lines` isn't turned on, the file will be read from the beginning of each `Refresh_Interval` until the file is rotated.
@@ -429,3 +430,86 @@ While file rotation is handled, there are risks of potential log loss when using
429430
- Final note: the `Path` patterns can't match the rotated files. Otherwise, the rotated file would be read again and lead to duplicate records.
430431

431432
{% endhint %}
433+
434+
## Character Encoding Conversion
435+
436+
This feature allows Fluent Bit to convert logs from various character encodings into the standard UTF-8 format.
437+
This is crucial for processing logs from systems, especially Windows, that use legacy or non-UTF-8 encodings.
438+
Proper conversion ensures that your log data is correctly parsed, indexed, and searchable.
439+
440+
### When to Use This Feature
441+
442+
You should use this feature if your log files or messages are not in UTF-8 and you are seeing garbled or incorrectly rendered characters.
443+
This is common in environments that use:
444+
445+
* Modern Windows applications that log in UTF-16.
446+
447+
* Legacy Windows systems with applications that use traditional code pages (e.g., ShiftJIS, GBK, Win1252).
448+
449+
### Configuration Parameters
450+
451+
To enable encoding conversion, you will use one of the following two parameters within an input plugin configuration.
452+
453+
1. `Unicode.Encoding`
454+
455+
Use this parameter for high-performance conversion of UTF-16 encoded logs to UTF-8. This method utilizes modern processor features (SIMD instructions) to accelerate the conversion process, making it highly efficient.
456+
457+
* Use Case: Ideal for logs coming from modern Windows environments that default to UTF-16.
458+
* Supported Values:
459+
* UTF-16LE (Little-Endian)
460+
* UTF-16BE (Big-Endian)
461+
462+
2. `Generic.Encoding`
463+
464+
Use this parameter to convert from a wide variety of other character encodings, particularly legacy Windows code pages.
465+
466+
* Use Case: Essential for logs from older systems or applications configured for specific regions, common in East Asia and Eastern Europe.
467+
* Supported Values: You can use any of the names or aliases listed below.
468+
469+
### East Asian Encodings
470+
* `ShiftJIS` (Aliases: `SJIS`, `CP932`, `Windows-31J`)
471+
* `GB18030`
472+
* `GBK`: (Alias: `CP936`)
473+
* `UHC` (Unified Hangul Code): (Aliases: `CP949` and `Windows-949`)
474+
* `Big5`: (Alias: `CP950`)
475+
476+
### Windows (ANSI) Encodings
477+
* `Win1250` (Central European): (Alias: `CP1250`)
478+
* `Win1251` (Cyrillic): (Alias: `CP1251`)
479+
* `Win1252` (Western European / Latin): (Alias: `CP1252`)
480+
* `Win1253` (Greek): (Alias: `CP1253`)
481+
* `Win1254` (Turkish): (Alias: `CP1254`)
482+
* `Win1255` (Hebrew): (Alias: `CP1255`)
483+
* `Win1256` (Arabic): (Alias: `CP1256`)
484+
485+
### DOS (OEM) Encodings
486+
* `Win866` (Cyrillic - DOS): (Alias: `CP866`)
487+
* `Win874` (Thai): (Alias: `CP874`)
488+
489+
### Configuration Example
490+
491+
Here is an example of how to use `Generic.Encoding` with the Tail input plugin to read a log file encoded in ShiftJIS.
492+
493+
{% tabs %}
494+
{% tab title="fluent-bit.yaml" %}
495+
496+
```yaml
497+
pipeline:
498+
inputs:
499+
- name: tail
500+
path: /var/log/containers/*.log
501+
generic.encoding: ShiftJIS
502+
```
503+
504+
{% endtab %}
505+
{% tab title="fluent-bit.conf" %}
506+
507+
```text
508+
[INPUT]
509+
Name tail
510+
Path C:\path\to\your\sjis.log
511+
Generic.Encoding ShiftJIS
512+
```
513+
514+
{% endtab %}
515+
{% endtabs %}

0 commit comments

Comments
 (0)