# \_dateparsefailure mapping date and time to @timestamp field

**URL:** <https://discuss.elastic.co/t/dateparsefailure-mapping-date-and-time-to-timestamp-field/271509>\
**Category:** Logstash\
**Created:** [April 28, 2021, 12:24pm UTC](https://discuss.elastic.co/t/dateparsefailure-mapping-date-and-time-to-timestamp-field/271509 "2021-04-28T12:24:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wilks](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@Wilks](https://discuss.elastic.co/u/Wilks)\
**Post date:** [April 28, 2021, 12:24pm UTC](https://discuss.elastic.co/t/dateparsefailure-mapping-date-and-time-to-timestamp-field/271509/1 "2021-04-28T12:24:59Z")

</div>

I am getting a \_dateparsefailure when I try to map the date and time the log arrived to the @timestamp field. Below is my filter, if I comment out the attempt to map to @timestamp I dont get a \_dateparsefailure so it somethhing with match =\> ["timestamp", "yyy-MM-dd HH:mm:ss"]  
The log is as follows:

2021-04-22-07.29.58.938095

```auto
grok {

       pattern_definitions => {
                      "CUSTOMTIMESTAMP" => "%{YEAR}-%{MONTHNUM}-%{MONTHDAY}\S+%{HOUR}.%{MINUTE}.%{SECOND}"
        }
        match => { "message" => [ "%{CUSTOMTIMESTAMP:timestamp}
        }

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

```

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 28, 2021, 1:50pm UTC](https://discuss.elastic.co/t/dateparsefailure-mapping-date-and-time-to-timestamp-field/271509/2 "2021-04-28T13:50:09Z")

</div>

The string of your timestamp needs to match the pattern in the date filter, which is not happening.

Your pattern in the date filter is `yyyy-MMM-dd HH:mm:ss`, this pattern will expect a date with the following format: `2021-Apr-28 10:47:23`, for example.

Your date is in the format `2021-04-22-07.29.58.938095`, so it won't match.

Try to use this pattern in the date filter: `yyyy-MM-dd-HH.mm.ss.SSSSSS`

---

<div class="post-metadata">

**Author:** ![Wilks](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@Wilks](https://discuss.elastic.co/u/Wilks)\
**Post date:** [April 28, 2021, 4:17pm UTC](https://discuss.elastic.co/t/dateparsefailure-mapping-date-and-time-to-timestamp-field/271509/3 "2021-04-28T16:17:52Z")

</div>

Worked. THX

---

<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:** [May 26, 2021, 4:18pm UTC](https://discuss.elastic.co/t/dateparsefailure-mapping-date-and-time-to-timestamp-field/271509/4 "2021-05-26T16:18:07Z")

</div>

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