2015-06-28 45 views
4

我試圖在Logstash上使用CSV過濾器,但它可以上傳我的文件的值。 我使用的是Ubuntu Server 14.04,kibana 4,logstash 1.4.2和elasticsearch 1.4.4。 接下來我顯示我的CSV文件和我寫的過濾器。難道我做錯了什麼?使用Logstash CSV過濾器不起作用


CSV文件:

Joao,21,555 
Miguel,24,1000 
Rodrigo,43,443 
Maria,54,2343 
Antonia,67,213 

Logstash CSV濾波器:

#Este e filtro que le o ficheiro e permite alocar os dados num index do Elasticsearch 
input 
{ 
    file 
    { 
     path => ["/opt/logstash/bin/testeFile_lite.csv"] 
     start_position => "beginning" 
     # sincedb_path => "NIL" 
    } 
} 
filter 
{ 
    csv 
    { 
     columns => ["nome", "idade", "salario"] 
     separator => "," 
    } 
} 
output 
{ 
    elasticsearch 
    { 
     action => "index" 
     host => "localhost" 
     index => "logstash-%{+YYYY.MM.dd}" 
    } 
    stdout 
    { 
     codec => rubydebug 
    } 
} 

當我執行過濾器,會出現:使用里程碑2輸入插件 '文件'。 ..並使用里程碑2輸入插件'csv'...和確定消息不a ppear。

有人可以幫助我嗎?

回答

4

我解決了輸入文件中添加場sincedb_path問題。

這裏的Logstash CSV過濾器:

input 
{ 
     file 
     { 
      path => "/opt/logstash/bin/testeFile_lite.csv" 
      type => "testeFile_lite" 
      start_position => "beginning" 
      sincedb_path => "/opt/logstash/bin/dbteste" 
     } 
} 
filter 
{ 
    csv 
     { 
      columns => ['nome', 'idade', 'salario'] 
      separator => "," 
     } 

} 
output 
{ 
    elasticsearch 
    { 
     action => "index" 
     host => "localhost" 
     index => "xpto" 
     cluster => "SIC_UTAD" 
    } 

    stdout 
    { 
     codec => rubydebug 
    } 
}