Skip to content

Commit e54556f

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 cbfe1e9 commit e54556f

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

pipeline/inputs/tail.md

Lines changed: 91 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 non-Unicode encoding of the file data. Supported values: `ShiftJIS`, `UHC`, `GBK`, `GB18030`, `Big5`, `Win866`, `Win874`, `Win1250`, `Win1251`, `Win1252`, `Win2513`, `Win1254`, `Win1255`, and `Win1256`. | `none` |
4142

4243
## Buffers and memory management
4344

@@ -84,6 +85,13 @@ The `Unicode.Encoding` parameter is dependent on the simdutf library, which is i
8485
Additionally, the `auto` setting for `Unicode.Encoding` isn't supported in all cases, and can make mistakes when it tries to guess the correct encoding. For best results, use either the `UTF-16LE` or `UTF-16BE` setting if you know the encoding type of the target file.
8586
{% endhint %}
8687

88+
{% hint style="info" %}
89+
The `Unicode.Encoding` parameter is dependent on the simdutf library, which is itself dependent on C++ version 11 or later. In environments that use earlier versions of C++, the `Unicode.Encoding` parameter will fail.
90+
91+
Additionally, the `auto` setting for `Unicode.Encoding` isn't supported in all cases, and can make mistakes when it tries to guess the correct encoding. For best results, use either the `UTF-16LE` or `UTF-16BE` setting if you know the encoding type of the target file.
92+
{% endhint %}
93+
94+
8795
## Monitor a large number of files
8896

8997
To monitor a large number of files, you can increase the `inotify` settings in your Linux environment by modifying the following `sysctl` parameters:
@@ -464,3 +472,86 @@ While file rotation is handled, there are risks of potential log loss when using
464472
- Final note: the `Path` patterns can't match the rotated files. Otherwise, the rotated file would be read again and lead to duplicate records.
465473

466474
{% endhint %}
475+
476+
## Character Encoding Conversion
477+
478+
This feature allows Fluent Bit to convert logs from various character encodings into the standard UTF-8 format.
479+
This is crucial for processing logs from systems, especially Windows, that use legacy or non-UTF-8 encodings.
480+
Proper conversion ensures that your log data is correctly parsed, indexed, and searchable.
481+
482+
### When to Use This Feature
483+
484+
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.
485+
This is common in environments that use:
486+
487+
* Modern Windows applications that log in UTF-16.
488+
489+
* Legacy Windows systems with applications that use traditional code pages (e.g., ShiftJIS, GBK, Win1252).
490+
491+
### Configuration Parameters
492+
493+
To enable encoding conversion, you will use one of the following two parameters within an input plugin configuration.
494+
495+
1. `Unicode.Encoding`
496+
497+
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.
498+
499+
* Use Case: Ideal for logs coming from modern Windows environments that default to UTF-16.
500+
* Supported Values:
501+
* UTF-16LE (Little-Endian)
502+
* UTF-16BE (Big-Endian)
503+
504+
2. `Generic.Encoding`
505+
506+
Use this parameter to convert from a wide variety of other character encodings, particularly legacy Windows code pages.
507+
508+
* Use Case: Essential for logs from older systems or applications configured for specific regions, common in East Asia and Eastern Europe.
509+
* Supported Values: You can use any of the names or aliases listed below.
510+
511+
### East Asian Encodings
512+
* `ShiftJIS` (Aliases: `SJIS`, `CP932`, `Windows-31J`)
513+
* `GB18030`
514+
* `GBK`: (Alias: `CP936`)
515+
* `UHC` (Unified Hangul Code): (Aliases: `CP949` and `Windows-949`)
516+
* `Big5`: (Alias: `CP950`)
517+
518+
### Windows (ANSI) Encodings
519+
* `Win1250` (Central European): (Alias: `CP1250`)
520+
* `Win1251` (Cyrillic): (Alias: `CP1251`)
521+
* `Win1252` (Western European / Latin): (Alias: `CP1252`)
522+
* `Win1253` (Greek): (Alias: `CP1253`)
523+
* `Win1254` (Turkish): (Alias: `CP1254`)
524+
* `Win1255` (Hebrew): (Alias: `CP1255`)
525+
* `Win1256` (Arabic): (Alias: `CP1256`)
526+
527+
### DOS (OEM) Encodings
528+
* `Win866` (Cyrillic - DOS): (Alias: `CP866`)
529+
* `Win874` (Thai): (Alias: `CP874`)
530+
531+
### Configuration Example
532+
533+
Here is an example of how to use `Generic.Encoding` with the Tail input plugin to read a log file encoded in ShiftJIS.
534+
535+
{% tabs %}
536+
{% tab title="fluent-bit.yaml" %}
537+
538+
```yaml
539+
pipeline:
540+
inputs:
541+
- name: tail
542+
path: /var/log/containers/*.log
543+
generic.encoding: ShiftJIS
544+
```
545+
546+
{% endtab %}
547+
{% tab title="fluent-bit.conf" %}
548+
549+
```text
550+
[INPUT]
551+
Name tail
552+
Path C:\path\to\your\sjis.log
553+
Generic.Encoding ShiftJIS
554+
```
555+
556+
{% endtab %}
557+
{% endtabs %}

0 commit comments

Comments
 (0)