# Use the log time and date in the timestamp

**URL:** https://discuss.elastic.co/t/use-the-log-time-and-date-in-the-timestamp/213223
**Category:** Logstash
**Created:** [December 27, 2019, 6:57pm UTC](https://discuss.elastic.co/t/use-the-log-time-and-date-in-the-timestamp/213223 "2019-12-27T18:57:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel\_Calisto](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Daniel\_Calisto](https://discuss.elastic.co/u/Daniel_Calisto)
#### Post date: [December 27, 2019, 6:57pm UTC](https://discuss.elastic.co/t/use-the-log-time-and-date-in-the-timestamp/213223/1 "2019-12-27T18:57:46Z")

</div>

Hi, Im trying to use the date and time in the log as the timestamp in elastic.

this is part of the log

12/27/19 06:46:39

this is the grok and the date filter to use the log date and time to use in the timestamp  
grok{  
match =\> {"message" =\> "%{DATA:date} %{TIME:time}"}  
}

```
    date {
            match => ["date time", "MM/dd/yy HH:mm:ss"]
            target => "@timestamp"
    }

```

how can I achieve this?

---

<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: [December 28, 2019, 12:38am UTC](https://discuss.elastic.co/t/use-the-log-time-and-date-in-the-timestamp/213223/2 "2019-12-28T00:38:45Z")

</div>

Use mutate+add\_field with sprintf references to combine date and time into a single field, or else use the pattern definitions option on the grok filter to define a pattern that combines "%{DATE} %{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: [January 25, 2020, 12:38am UTC](https://discuss.elastic.co/t/use-the-log-time-and-date-in-the-timestamp/213223/3 "2020-01-25T00:38:47Z")

</div>

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