Logstash CSV not working

I am trying to read CSV data in logstash, but some like logstash cannot split the lines, treating them as csv

Logstash configuration

input { file { path => [ "/root/logstash/temp.csv" ] start_position => "beginning" } } filter { csv { columns => ['A','B','C','D','E'] } } output { stdout { } } 

CSV file test

 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 output

 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 

Can someone help me with this problem?

1) I tried replacing the single quote with double quotation marks in the columns

2) I tried with different data

I expect the column output mentioned in this link https://blog.trifork.com/2014/01/28/using-logstash-elasticsearch-and-kibana-to-monitor-your-video-card-a-tutorial/

+7
csv logstash
source share
1 answer

In the output you need to specify the codec.

For example, with your configuration,

 input { file { path => [ "/root/logstash/temp.csv" ] start_position => "beginning" } } filter { csv { columns => ['A','B','C','D','E'] } } output { stdout { codec => rubydebug } } 

Add a codec , and then you can get what you want.

 { "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" } 
+7
source share

All Articles