Date format error from elasticsearch

Hello,
I originally posted this in the Logstash forum but it was suggested that I should post in Elasticsearch instead.

I'm getting a date format error from elasticsearch but the format seems to match the posted date object. Can some one see specifically what it is complaining about?

Return error from Elasticsearch:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse field [date] of type [date] in document with id 'KGcZb3cBqhj6kAxank_x'. Preview of field's value: '2021-04-02T07:18:45.000Z'"}],"type":"mapper_parsing_exception","reason":"failed to parse field [date] of type [date] in document with id 'KGcZb3cBqhj6kAxank_x'. Preview of field's value: '2021-04-02T07:18:45.000Z'","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse date field [2021-04-02T07:18:45.000Z] with format [yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd HH:mm:ss,SSS||yyyy/MM/dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ss.SSSZZZ||yyyy-MM-dd||epoch_millis]","caused_by":{"type":"date_time_parse_exception","reason":"Failed to parse with all enclosed parsers"}}},"status":400}

Here is the document I'm posting:

{
       "message":"2021/02/04 07:18:45 | xxxxxxxx.xxxxxxxx.PDF.1612451907436 INFO  com.ixiasoft.outputgenerator.preprocessor.AntProcessor - Done Processing AntProcessor. wkdy.dita2pdf",
     "exception":"Done Processing AntProcessor. wkdy.dita2pdf",
      "loglevel":"INFO",
          "host.name":"logstash-dev-poc",
       "service":"xxxxxxxx.xxxxxxxx.PDF.1612451907436",
    "@timestamp":"2021-02-04T19:44:07.822Z",
        "logger":"com.ixiasoft.outputgenerator.preprocessor.AntProcessor",
          "date":"2021-04-02T07:18:45.000Z"
}

It seems "date" should match on this format string?
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"

Here is the "date" index mapping:

        "date" : {
          "type" : "date",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          },
          "format" : "yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd HH:mm:ss,SSS||yyyy/MM/dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ss.SSSZZZ||yyyy-MM-dd||epoch_millis"
        },

TIA!

Seen this?

Correct solution from @Badger in Logstash forum:

Z would match -0700 . Try yyyy-MM-dd'T'HH:mm:ss.SSS'Z'

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