Skip to content

Commit d8ef3d9

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 d1ddc43 commit d8ef3d9

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 encoding which the origin of character encoding. Currently, UTF-16LE, UTF-16BE, and auto is supported. | _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" %} If the database parameter `DB` isn't
4344
specified, by default the plugin reads each target file from the
@@ -436,3 +437,86 @@ While file rotation is handled, there are risks of potential log loss when using
436437
- Final note: the `Path` patterns can't match the rotated files. Otherwise, the rotated file would be read again and lead to duplicate records.
437438

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

0 commit comments

Comments
 (0)