# Dateparsefailure in date filter

**URL:** <https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696>\
**Category:** Logstash\
**Created:** [May 14, 2018, 8:51am UTC](https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696 "2018-05-14T08:51:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgprb](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pgprb](https://discuss.elastic.co/u/pgprb)\
**Post date:** [May 14, 2018, 8:51am UTC](https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696/1 "2018-05-14T08:51:04Z")

</div>

Hi there,

I'm always having dateparsefailure while doing a simple date filter to convert a string to date. The date format that I am passing is this:

2018-05-10 11:36:15

And right now in the conf file I have:

date {  
match =\> ["ServerTimestamp", "yyyy-MM-dd HH:mm:ss"]  
target =\> "ServerTime"  
}

The field ServerTimestamp is a string. I have changed the date filter a lot of times (YYYY-MM-dd and on) and I'm always having dateparsefailure so I have no idea what am I doing wrong.

Many thanks,

---

<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:** [May 14, 2018, 2:48pm UTC](https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696/2 "2018-05-14T14:48:24Z")

</div>

If your events contained a field called ServerTimestamp in that format then that date filter would parse it, and not add a \_dateparsefailure tag. So I infer that either the field is not named ServerTimestamp, or it is not in that format. Can you show us an event using output { stdout { codec =\> rubydebug } }, or if you are using Kibana, copy and paste from the JSON tab in Discover.

---

<div class="post-metadata">

**Author:** ![pgprb](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pgprb](https://discuss.elastic.co/u/pgprb)\
**Post date:** [May 14, 2018, 3:10pm UTC](https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696/3 "2018-05-14T15:10:55Z")

</div>

Hi @Badger

This is a small copy from the JSON

"CollectPublishingInstances": [  
19.12  
],  
**"ServerTimestamp": [**  
\*\* "2018-05-10 11:36:15"\*\*  
],  
"SaveValues\_": [  
14.81  
],

As you can see, there is a field named ServerTimestamp and has that format.

Thanks!

---

<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:** [May 14, 2018, 4:16pm UTC](https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696/4 "2018-05-14T16:16:50Z")

</div>

It an array.

```
mutate { replace => { "ServerTimestamp" => "%{[ServerTimestamp][0]}"

```

If everything is an array because you parsed it using an xml filter, you might want to see if force\_array =\> false works for you.

---

<div class="post-metadata">

**Author:** ![pgprb](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pgprb](https://discuss.elastic.co/u/pgprb)\
**Post date:** [May 15, 2018, 8:15am UTC](https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696/5 "2018-05-15T08:15:08Z")

</div>

This worked, thank you very much @Badger

---

<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:** [June 12, 2018, 8:15am UTC](https://discuss.elastic.co/t/dateparsefailure-in-date-filter/131696/6 "2018-06-12T08:15:14Z")

</div>

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