# Grok pattern/expression for "YYYY/MM/dd HH:mm:ss"

**URL:** https://discuss.elastic.co/t/grok-pattern-expression-for-yyyy-mm-dd-hh-mm-ss/122821
**Category:** Logstash
**Created:** [March 7, 2018, 5:39am UTC](https://discuss.elastic.co/t/grok-pattern-expression-for-yyyy-mm-dd-hh-mm-ss/122821 "2018-03-07T05:39:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ruranga](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@ruranga](https://discuss.elastic.co/u/ruranga)
#### Post date: [March 7, 2018, 5:39am UTC](https://discuss.elastic.co/t/grok-pattern-expression-for-yyyy-mm-dd-hh-mm-ss/122821/1 "2018-03-07T05:39:46Z")

</div>

Hi,

Issue regarding grok patter. I need to create a grok pattern for following log. But I'm having problems with 2018/03/06 10:21:49 (YYYY/MM/dd HH:mm:ss) date format. Can anyone please help

Sample log:

INFO | jvm 1 | 2018/03/06 10:21:49 | 18/03/06 10:21:49 INFO SMPPSession: SMSMessage ...

Thanks in adavcne

---

<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: [March 7, 2018, 9:50am UTC](https://discuss.elastic.co/t/grok-pattern-expression-for-yyyy-mm-dd-hh-mm-ss/122821/2 "2018-03-07T09:50:59Z")

</div>

Have you tried using the grok constructor web site?

Your date format is very close to that of most HTTP logs so you can draw inspiration from the HTTPDATE pattern:

> <https://github.com/logstash-plugins/logstash-patterns-core/blob/v2.0.5/patterns/grok-patterns#L86>

---

<div class="post-metadata">

### Author: ![ruranga](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@ruranga](https://discuss.elastic.co/u/ruranga)
#### Post date: [March 23, 2018, 4:53am UTC](https://discuss.elastic.co/t/grok-pattern-expression-for-yyyy-mm-dd-hh-mm-ss/122821/3 "2018-03-23T04:53:23Z")

</div>

> [@magnusbaeck](#):
>
> ur date format is very close to that of most HTTP logs so you can draw inspiration from the HTTPDATE pattern:

YES. Tried with following and got succeeded.

(?\<REQ\_TIME\>%{YEAR}/%{MONTHNUM}/%{MONTHDAY} %{TIME})

Many thanks for the support

---

<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: [April 20, 2018, 5:02am UTC](https://discuss.elastic.co/t/grok-pattern-expression-for-yyyy-mm-dd-hh-mm-ss/122821/4 "2018-04-20T05:02:46Z")

</div>

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