# Failed to parse field \[eAgent.tstEvent\] of type \[date\]

**URL:** https://discuss.elastic.co/t/failed-to-parse-field-eagent-tstevent-of-type-date/275576
**Category:** Logstash
**Created:** [June 10, 2021, 1:24pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-eagent-tstevent-of-type-date/275576 "2021-06-10T13:24:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vaclav1](https://avatars.discourse-cdn.com/v4/letter/v/c68b51/32.png) [@vaclav1](https://discuss.elastic.co/u/vaclav1)
#### Post date: [June 10, 2021, 1:24pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-eagent-tstevent-of-type-date/275576/1 "2021-06-10T13:24:26Z")

</div>

Dear team,

I have used date filter plugin to parse the date field:

```auto
date {
  	match => ["[message][tstEventPlan]", "yyyy-MM-dd HH:mm:ss'.'SSS" ]
  	remove_field => ["[message][tstEventPlan]" ]
  	target => "[eAgent][tstEventPlan]"
    tag_on_failure => "_dateparsefailure"
}

```

But got an error:

```auto
[2021-06-10T15:16:32,569][WARN][logstash.outputs.elasticsearch][main][6771b6c1505e1d68ae197acd17a5ef39974052336877cc4d69a93d23ef9469dd] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"gelogext-lux", :routing=>nil, :_type=>"_doc"}, #<LogStash::Event:0x68f7b966>], :response=>{"index"=>{"_index"=>"gelogext-lux-2021.06.10-000001", "_type"=>"_doc", "_id"=>"aIgR9nkBjZSEu97_MdqM", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [eAgent.tstEvent] of type [date] in document with id 'aIgR9nkBjZSEu97_MdqM'. Preview of field's value: '2021-06-10 13:16:29.550'", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"failed to parse date field [2021-06-10 13:16:29.550] with format [date_time]", "caused_by"=>{"type"=>"date_time_parse_exception", "reason"=>"date_time_parse_exception: Failed to parse with all enclosed parsers"}}}}}}

```

Example of the value is: 2021-06-10 13:16:29.550

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [June 10, 2021, 4:35pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-eagent-tstevent-of-type-date/275576/2 "2021-06-10T16:35:11Z")

</div>

"caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"failed to parse date field [2021-06-10 13:16:29.550] with format [date\_time]"

Your elasticsearch index has a template that tells it that [eAgent][tstEvent] (not [eAgent][tstEventPlan]) should be a date\_time. The format [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats) says that date\_time is

> A formatter that combines a full date and time, separated by a _T_ : `yyyy-MM-dd'T'HH:mm:ss.SSSZZ` .

and "2021-06-10 13:16:29.550" does not match that pattern so it cannot be parsed. Change your template, or mutate+gsub your field into compliance with the requirements of the parser.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 8, 2021, 4:35pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-eagent-tstevent-of-type-date/275576/3 "2021-07-08T16:35:49Z")

</div>

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