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"
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM