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