user829174
user829174

Reputation: 6362

Logstash filter parse date format

I am trying to parse csv and output it to elastic, I am having issue with the date format

Date,In1,In2,In3,In4,In5,In6 
31/12/2015,1527.96,1527.95,1528.74,1534.43,1525.76,716485827
30/12/2015,1534.59,1532.26,1527.96,1534.55,1526.47,716485827
29/12/2015,1524.67,1532.47,1534.59,1535.73,1530.90,717176468
28/12/2015,1533.85,1533.09,1524.67,1533.16,1523.20,710573918

logstash.config

# test file
input {
   file {
      path => "/config/file.csv"
      type => "core2"
      start_position => "beginning"
   }
}

filter {
 csv {
     separator => ","
    }
}

output {
    elasticsearch {
        action => "index"
        hosts => ["elastic:9200"]
        index => "ta25"
        workers => 1
    }

}

How to I parse Date column to logstash filter?

Upvotes: 0

Views: 614

Answers (1)

Gerardo Rochín
Gerardo Rochín

Reputation: 309

Use the filter date https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date

filter {
  date {
    match => [ "Date", "dd/mm/YYYY" ]
  }
}

Upvotes: 1

Related Questions