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