# How to extract date from some field containing Date and time in logstash

**URL:** https://discuss.elastic.co/t/how-to-extract-date-from-some-field-containing-date-and-time-in-logstash/180550
**Category:** Logstash
**Created:** [May 10, 2019, 11:59am UTC](https://discuss.elastic.co/t/how-to-extract-date-from-some-field-containing-date-and-time-in-logstash/180550 "2019-05-10T11:59:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Simran\_Kaur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simran_kaur/32/45977_2.png) [@Simran\_Kaur](https://discuss.elastic.co/u/Simran_Kaur)
#### Post date: [May 10, 2019, 11:59am UTC](https://discuss.elastic.co/t/how-to-extract-date-from-some-field-containing-date-and-time-in-logstash/180550/1 "2019-05-10T11:59:43Z")

</div>

hello there,  
I'm trying to dump data from My Sql to elastic search but i have one field called "eventTime" which contains both date and time.  
eg. 04/05/2019 15:23:45  
now I want to extract this date from the field and dump the data to ES.  
it's been so many days that i'm trying to get a solution but couldn't find any.  
@magnusbaeck hope to get a reply soon ,  
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 10, 2019, 3:07pm UTC](https://discuss.elastic.co/t/how-to-extract-date-from-some-field-containing-date-and-time-in-logstash/180550/2 "2019-05-10T15:07:26Z")

</div>

How about

```
grok { match => { "eventTime" => "^(?<date>[0-9/]{10})" } }
```

---

<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 7, 2019, 3:07pm UTC](https://discuss.elastic.co/t/how-to-extract-date-from-some-field-containing-date-and-time-in-logstash/180550/3 "2019-06-07T15:07:28Z")

</div>

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