logstash 编码转换默认UTF8

[elk@node01 conf]$ cat logstash01.conf 
input {
    file {
      path=>["/home/elk/conf/5555.txt"]
      type =>"system"
      start_position=>"beginning"
      codec => plain{
charset=>"GBK"
}
     
}
}

output {  
        stdout {  
            codec => rubydebug  
        }  
      } 

[elk@node01 conf]$ logstash -f logstash01.conf 
Settings: Default pipeline workers: 4
Received an event that has a different character encoding than you configured. {:text=>"\xB7ɻ\xFA1", :expected_charset=>"UTF-8", :level=>:warn}
Pipeline main started
Received an event that has a different character encoding than you configured. {:text=>"\xB7ɻ\xFA2", :expected_charset=>"UTF-8", :level=>:warn}
{
       "message" => "\xB7ɻ\xFA1",
      "@version" => "1",
    "@timestamp" => "2018-08-01T02:34:28.124Z",
          "path" => "/home/elk/conf/2222.txt",
          "host" => "node01",
          "type" => "system"
}
{
       "message" => "\xB7ɻ\xFA2",
      "@version" => "1",
    "@timestamp" => "2018-08-01T02:34:28.285Z",
          "path" => "/home/elk/conf/2222.txt",
          "host" => "node01",
          "type" => "system"
}

[elk@node01 conf]$ logstash -f logstash01.conf 
Settings: Default pipeline workers: 4
Pipeline main started
{
       "message" => "飞机1",
      "@version" => "1",
    "@timestamp" => "2018-08-01T02:38:46.381Z",
          "path" => "/home/elk/conf/5555.txt",
          "host" => "node01",
          "type" => "system"
}
{
       "message" => "飞机2",
      "@version" => "1",
    "@timestamp" => "2018-08-01T02:38:46.486Z",
          "path" => "/home/elk/conf/5555.txt",
          "host" => "node01",
          "type" => "system"
}
{
       "message" => "飞机3",
      "@version" => "1",
    "@timestamp" => "2018-08-01T02:38:46.487Z",
          "path" => "/home/elk/conf/5555.txt",
          "host" => "node01",
          "type" => "system"
}
原文地址:https://www.cnblogs.com/hzcya1995/p/13349068.html