# \[parsing date error\]: date\_time\_parse\_exception: Failed to parse with all enclosed parsers

**URL:** <https://discuss.elastic.co/t/parsing-date-error-date-time-parse-exception-failed-to-parse-with-all-enclosed-parsers/260804>\
**Category:** Logstash\
**Created:** [January 12, 2021, 9:40am UTC](https://discuss.elastic.co/t/parsing-date-error-date-time-parse-exception-failed-to-parse-with-all-enclosed-parsers/260804 "2021-01-12T09:40:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [January 12, 2021, 11:05am UTC](https://discuss.elastic.co/t/parsing-date-error-date-time-parse-exception-failed-to-parse-with-all-enclosed-parsers/260804/2 "2021-01-12T11:05:35Z")

</div>

Hello Abdelhalim,

According to the docs [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html):

> Date formats can be customised, but if no format is specified then it uses the default:
> 
> "strict\_date\_optional\_time||epoch\_millis"

strict\_date\_optional\_time is described [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#strict-date-time):

> A generic ISO datetime parser, where the date must include the year at a minimum, and the time (separated by `T` ), is optional. Examples: `yyyy-MM-dd'T'HH:mm:ss.SSSZ` or `yyyy-MM-dd` .

To solve that, you have to update your template and define your date format like this:

```auto
PUT _template/urlhaus
{
  "index_patterns": ["urlhaus-*"], 
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 1,
    "index.lifecycle.name": "hot-warm-cold-delete-6months-policy",  
    "index.lifecycle.rollover_alias": "urlhaus"
  },
  "mappings": {
    "properties": {
    
     "id": {"type": "long" },
     "dateadded": {"type": "date", "format": "yyyy-MM-dd HH:mm:ss"},
     "url": { "type": "text"}, 
     "url_status": {"type": "keyword"},
     "threat": {"type": "text"}, 
     "tags": {"type": "text"}, 
     "urlhaus_link": {"type": "text"}, 
     "reporter": {"type": "keyword"}
    }
  } 
}

```

Best regards  
Wolfram

---

_[View the full topic](https://discuss.elastic.co/t/parsing-date-error-date-time-parse-exception-failed-to-parse-with-all-enclosed-parsers/260804)._
