logstash unicode encoding @Arthur

1. Test process

Querying the problem of garbled characters, it is said that if you modify the logstash configuration file as follows:

input {

tcp {

port=>port  
codec => plain{ charset => "UTF-8" } 
}

}

output {

elasticsearch {

hosts => ["ip:port"]

index => "test-logstash-%{+YYYY-MM}"  

codec => plain{ charset => "UTF-8" } 

}

}

Changing UTF-8 to GBK and GB2312 will not work.

Two, that's right

Change the codec => plain{ charset => "UTF-8" } in the input to codec => json_lines , that's it. The complete configuration is as follows:

input {

tcp {

port=>port  
codec => json_lines 
}

}   

output {

elasticsearch {

hosts => ["ip:port"]

index => "test-logstash-%{+YYYY-MM}"  

}

}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325606338&siteId=291194637