# Use parsed date/time fields to prepare @timestamp

**URL:** https://discuss.elastic.co/t/use-parsed-date-time-fields-to-prepare-timestamp/128984
**Category:** Logstash
**Created:** [April 22, 2018, 2:01am UTC](https://discuss.elastic.co/t/use-parsed-date-time-fields-to-prepare-timestamp/128984 "2018-04-22T02:01:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Saurabh\_Jinturkar](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@Saurabh\_Jinturkar](https://discuss.elastic.co/u/Saurabh_Jinturkar)
#### Post date: [April 22, 2018, 2:01am UTC](https://discuss.elastic.co/t/use-parsed-date-time-fields-to-prepare-timestamp/128984/1 "2018-04-22T02:01:33Z")

</div>

Hi,

I am trying to parse HAProxy logs in Logstash. I am using standard pattern available [here](https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/haproxy) to parse the log. Filter is parsing date however, I want to use those fields to create a timestamp for the log.

Do I need to use date filter plugin or is it possible through something else? Any pointers on this are welcome.

Thank you!

---

<div class="post-metadata">

### Author: ![MariumHassan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mariumhassan/32/30321_2.png) [@MariumHassan](https://discuss.elastic.co/u/MariumHassan)
#### Post date: [April 23, 2018, 5:39am UTC](https://discuss.elastic.co/t/use-parsed-date-time-fields-to-prepare-timestamp/128984/2 "2018-04-23T05:39:45Z")

</div>

Hi,

you can use [date filter plugin](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html) if you want to use your field to create a timestamp for your logs.

```auto
filter {
  date {
    match => ["logdate", "MMM dd yyyy HH:mm:ss"]
  }
}

```

It stores the matching timestamp into the @timestamp field of the event if the target field is not provided.

---

<div class="post-metadata">

### Author: ![Saurabh\_Jinturkar](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@Saurabh\_Jinturkar](https://discuss.elastic.co/u/Saurabh_Jinturkar)
#### Post date: [April 23, 2018, 6:25pm UTC](https://discuss.elastic.co/t/use-parsed-date-time-fields-to-prepare-timestamp/128984/3 "2018-04-23T18:25:56Z")

</div>

Thanks for the help!

Can I combine already parsed fields? For example, HAProxy pattern matches and creates fields year, monthday, month, hour, minutes and second. I just want to combine them to form the date since they are already matched.

---

<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: [April 23, 2018, 6:34pm UTC](https://discuss.elastic.co/t/use-parsed-date-time-fields-to-prepare-timestamp/128984/4 "2018-04-23T18:34:30Z")

</div>

Yes, you can use add\_field in most filters and use [sprintf notation](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html) to reference field values to insert.

---

<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: [May 21, 2018, 6:34pm UTC](https://discuss.elastic.co/t/use-parsed-date-time-fields-to-prepare-timestamp/128984/5 "2018-05-21T18:34:36Z")

</div>

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