Use Logstash CSV filter doesn't work

2019-05-05 08:56发布

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?

1条回答
劳资没心,怎么记你
2楼-- · 2019-05-05 09:25

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
    }
}
查看更多
登录 后发表回答