我正在尝试在logstash中读取CSV数据,但有些logstash无法将字符串视为csv
logstash配置
input { file { path => [ "/root/logstash/temp.csv" ] start_position => "beginning" } } filter { csv { columns => ['A','B','C','D','E'] } } output { stdout { } }
测试CSV文件
p,q,r,s,t p,q,r,s,t p,q,r,s,t p,q,r,s,t p,q,r,s,t p,q,r,s,t
logstash的输出
2014-04-23T13:26:53.415+0000 0.0.0.0 p,q,r,s,t 2014-04-23T13:26:53.416+0000 0.0.0.0 p,q,r,s,t 2014-04-23T13:26:53.416+0000 0.0.0.0 p,q,r,s,t 2014-04-23T13:26:53.417+0000 0.0.0.0 p,q,r,s,t 2014-04-23T13:26:53.417+0000 0.0.0.0 p,q,r,s,t 2014-04-23T13:26:53.418+0000 0.0.0.0 p,q,r,s,t
有人可以帮我解决这个问题吗?
1)我尝试用列中的双引号替换单引号
2)我尝试了不同的数据
我期待这个链接中提到的柱状输出https://blog.trifork.com/2014/01/28/using-logstash-elasticsearch-and-kibana-to-monitor-your-video-card-a-tutorial/
在输出中,您需要指定编解码器.
例如,用你的配置,
input { file { path => [ "/root/logstash/temp.csv" ] start_position => "beginning" } } filter { csv { columns => ['A','B','C','D','E'] } } output { stdout { codec => rubydebug } }
添加编解码器,然后您就可以得到您想要的.
{ "message" => [ [0] "p,q,r,s,t" ], "@version" => "1", "@timestamp" => "2014-04-24T02:57:37.099Z", "A" => "p", "B" => "q", "C" => "r", "D" => "s", "E" => "t" }