1、試驗過程json
查詢亂碼問題,都說要是修改logstash配置文件以下:elasticsearch
input {tcp
tcp {code
port=>port
codec => plain{ charset => "UTF-8" }
}ip
}input
output {ast
elasticsearch {test
hosts => ["ip:port"]亂碼
index => "test-logstash-%{+YYYY-MM}" 配置
codec => plain{ charset => "UTF-8" }
}
}
將UTF-8,改爲GBK、GB2312都無論用。
2、這樣就對了
將input裏的codec => plain{ charset => "UTF-8" } 改成codec => json_lines ,就對了。完整配置以下:
input {
tcp {
port=>port
codec => json_lines
}
}
output {
elasticsearch {
hosts => ["ip:port"]
index => "test-logstash-%{+YYYY-MM}"
}
}