Date parsing error : Invalid format


(Mehdi AOUADI) #1

I am trying to parse a date field from a jdbc input :

SELECT TO_CHAR(date_column, 'YYYY-MM-DD') || 'T' || TO_CHAR(date_column, 'HH24:MI:SS') || 'Z' as "my_date" FROM my_table

When I try to parse it in the filter so it can be used as @timestamp :

    filter {
          date {
               match => [ "my_date", "yyyy-MM-dd HH:mm:ss" ]
               target => "@timestamp"
         }
    }

I get the following error :

"Invalid format: \"2016-12-06 12:12:00\" is malformed at 12:12:00

The corresponding field mapping in Elasticsearch is :

"my_date_field" : { "type" : "date", "format" : "date_time_no_millis" }

Is the error due to the format I chose ?


(Mehdi AOUADI) #2

Finally I updated the filter using the ISO8601 Date Format and it works :

filter {
  date {
    match => [ "my_date", "ISO8601" ]
    target => "@timestamp"
  }
}

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.