1

i am trying to Generically map a csv file, so that the order of the columns wont matter. i know how to do this:

input {
  file {
    path => "/opt/tradertools/omer/omer.csv"
    type => "csv"
  }

  filter {
   if [type] == "csv" {
   csv{
   columns => ["col example 1","col example 2"]
   }

   output {
  stdout { codec => rubydebug }

  file {
        path => "/var/log/logstash/%{type}OMER.%{+yyyy.MM.dd.HH}"
    }
}

but if i switch the csv columns order, i also needs to change the code... someone got an idea?

mike
  • 767
  • 2
  • 10
  • 18
  • 1
    Modify the csv{} filter so that it takes a header row and name your fields from that. – Alain Collins Aug 17 '15 at 16:04
  • Grab [the code](https://github.com/logstash-plugins/logstash-filter-kv), modify it, and follow [the build doc](https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html) – Alain Collins Aug 19 '15 at 17:01

0 Answers0