简体   繁体   中英

Use Logstash CSV filter doesn't work

I was trying to use CSV filter on Logstash but it can upload values of my file. I'm using Ubuntu Server 14.04, kibana 4, logstash 1.4.2 and elasticsearch 1.4.4. Next I show my CSV file and filter I wrote. Am I doing something wrong?


CSV File:

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

Logstash CSV filter:

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

When I execute filter, appears: using milestone 2 input plugin 'file'... and using milestone 2 input plugin 'csv'... and the OK message doesn't appear.

Someone can help me?

I solved the problem adding the field sincedb_path in the input file.

Here's the Logstash CSV filter:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM