# Logstash - Unable to match date pattern

**URL:** <https://discuss.elastic.co/t/logstash-unable-to-match-date-pattern/138351>\
**Category:** Logstash\
**Created:** [July 3, 2018, 10:18am UTC](https://discuss.elastic.co/t/logstash-unable-to-match-date-pattern/138351 "2018-07-03T10:18:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [July 3, 2018, 10:18am UTC](https://discuss.elastic.co/t/logstash-unable-to-match-date-pattern/138351/1 "2018-07-03T10:18:57Z")

</div>

I am using a `json` input to filter some data and sent it to `elasticsearch`;

sample document from input `json` file:

```auto
{"preview":false,"offset":0,"result":{"@timestamp":"2016-11-30T21:59:43.000Z","@version":"1","_raw":"{ ..}}

```

I want my corresponding `elasticsearch` event to have the **exact same `timestamp`** as above;

However the following :

```auto
  date {
    match => ["[result][@timestamp]", "yyyy-MM-ddTHH:mm:ss.000Z" ]
    tag_on_failure => ["no_date_match"]
  }

```

yields

> Exception", :message=\>"Illegal pattern component: T"

Have also tried: `"yyyy-MM-dd HH:mm:ss.000Z`

but then I just get match failure.

Which pattern should I use?

---

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [July 3, 2018, 12:17pm UTC](https://discuss.elastic.co/t/logstash-unable-to-match-date-pattern/138351/2 "2018-07-03T12:17:51Z")

</div>

This seems to be working:

`yyyy-MM-dd'T'HH:mm:ss.000Z`

---

<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 31, 2018, 12:17pm UTC](https://discuss.elastic.co/t/logstash-unable-to-match-date-pattern/138351/3 "2018-07-31T12:17:53Z")

</div>

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