# Issues with DATESTAMP pattern

**URL:** <https://discuss.elastic.co/t/issues-with-datestamp-pattern/150624>\
**Category:** Logstash\
**Created:** [October 1, 2018, 11:00pm UTC](https://discuss.elastic.co/t/issues-with-datestamp-pattern/150624 "2018-10-01T23:00:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samvid\_Kulkarni](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@Samvid\_Kulkarni](https://discuss.elastic.co/u/Samvid_Kulkarni)\
**Post date:** [October 1, 2018, 11:00pm UTC](https://discuss.elastic.co/t/issues-with-datestamp-pattern/150624/1 "2018-10-01T23:00:29Z")

</div>

I am trying to parse the date which has YYYY/MM/DD HH:MM:SS format. For this I am using DATESTAMP pattern. If I just take the date from log `2018/09/26 17:00:04` and use `%{DATESTAMP:test}` then it gives proper output in grok debugger (inside kibana).

> {  
> "test": "18/09/26 17:00:04"  
> }

But if the date is surrounded by commas(,) then it gives error. So if it is like this `,2018/09/26 17:00:04,`and I use this pattern `\,%{DATESTAMP:test}\,` or even `,%{DATESTAMP:test},` results in error.

Is there some bug or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 3, 2018, 5:57pm UTC](https://discuss.elastic.co/t/issues-with-datestamp-pattern/150624/2 "2018-10-03T17:57:44Z")

</div>

> I am trying to parse the date which has YYYY/MM/DD HH:MM:SS format. For this I am using DATESTAMP pattern.

DATESTAMP is for mm/dd/yyyy and dd/mm/yyyy dates. See its definition:

> <https://github.com/logstash-plugins/logstash-patterns-core/blob/v4.1.2/patterns/grok-patterns#L67-L73>

Try this: `(?<timestamp>%{YEAR}/%{MONTHNUM}/%{MONTHDAY} %{TIME})`

---

<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:** [October 31, 2018, 5:57pm UTC](https://discuss.elastic.co/t/issues-with-datestamp-pattern/150624/3 "2018-10-31T17:57:44Z")

</div>

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