Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Logstash collects Chinese garbled codes

Shulou Source: shulou.com Published: 2022-06-03 04:32:41 11月25日 Update

R & D feedback graylog log shows garbled code (as shown below). The first reaction is that it is caused by the character set.

Check the system environment character set

[root@apiVM-007 ~] # locale

LANG=zh_CN.GB18030

LC_CTYPE= "zh_CN.GB18030"

LC_NUMERIC= "zh_CN.GB18030"

LC_TIME= "zh_CN.GB18030"

LC_COLLATE= "zh_CN.GB18030"

LC_MONETARY= "zh_CN.GB18030"

LC_MESSAGES= "zh_CN.GB18030"

LC_PAPER= "zh_CN.GB18030"

LC_NAME= "zh_CN.GB18030"

LC_ADDRESS= "zh_CN.GB18030"

LC_TELEPHONE= "zh_CN.GB18030"

LC_MEASUREMENT= "zh_CN.GB18030"

LC_IDENTIFICATION= "zh_CN.GB18030"

LC_ALL=

View log file encoding format

Check the logstash manual and find that it is configurable, public codec plug-in character set

Https://www.elastic.co/guide/en/logstash/5.6/plugins-codecs-multiline.html

Modify the configuration as follows, restart logstash, and solve the problem.

Tags: Character character set log configuration garbled manual plug-in file format environment system coding problem response check Chinese Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Information MySQL Linux NVidia