# Grok Custom Timestamp Filter

**URL:** <https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141>\
**Category:** Logstash\
**Created:** [October 3, 2019, 9:55am UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141 "2019-10-03T09:55:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghassan\_Zein](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghassan_zein/32/54311_2.png) [@Ghassan\_Zein](https://discuss.elastic.co/u/Ghassan_Zein)\
**Post date:** [October 3, 2019, 9:55am UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141/1 "2019-10-03T09:55:17Z")

</div>

Am not able to filter the following date through grok, it doesnt fall under any ready made TIMESTAMP filters:

07 Aug 2019 13:54:27.463

I want to retrive it and replace it with @timestamp (or create a "Date" variable and add it there)

Thanks

---

<div class="post-metadata">

**Author:** ![ben.west](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben.west/32/55244_2.png) [@ben.west](https://discuss.elastic.co/u/ben.west)\
**Post date:** [October 3, 2019, 10:52am UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141/2 "2019-10-03T10:52:07Z")

</div>

Hi,

You can use the [Date Filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html) to create arbitrary (and multiple) patterns for handling date/time stamps.

---

<div class="post-metadata">

**Author:** ![Ghassan\_Zein](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghassan_zein/32/54311_2.png) [@Ghassan\_Zein](https://discuss.elastic.co/u/Ghassan_Zein)\
**Post date:** [October 3, 2019, 10:55am UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141/3 "2019-10-03T10:55:57Z")

</div>

@ben.west I know about the Date Filter but am not able to find the right syntax to fit with my need. Can you please advise?

---

<div class="post-metadata">

**Author:** ![ben.west](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben.west/32/55244_2.png) [@ben.west](https://discuss.elastic.co/u/ben.west)\
**Post date:** [October 3, 2019, 11:01am UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141/4 "2019-10-03T11:01:06Z")

</div>

> [@Ghassan\_Zein](#):
>
> 07 Aug 2019 13:54:27.463

This should work: `dd MMM yyyy HH:mm:ss.SSS`

---

<div class="post-metadata">

**Author:** ![Ghassan\_Zein](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghassan_zein/32/54311_2.png) [@Ghassan\_Zein](https://discuss.elastic.co/u/Ghassan_Zein)\
**Post date:** [October 3, 2019, 11:04am UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141/5 "2019-10-03T11:04:29Z")

</div>

how would the whole config be in this case? like this?

```
date {
     match => ["Date", "dd MMM yyyy HH:mm:ss.SSS"]
     target => "Date"
    }
```

---

<div class="post-metadata">

**Author:** ![ben.west](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben.west/32/55244_2.png) [@ben.west](https://discuss.elastic.co/u/ben.west)\
**Post date:** [October 3, 2019, 12:24pm UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141/6 "2019-10-03T12:24:52Z")

</div>

Yes that should work. You mentioned in your original post you wanted to update the `@timestamp` field of the event so you can omit the target to do this automatically.

---

<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, 2019, 12:25pm UTC](https://discuss.elastic.co/t/grok-custom-timestamp-filter/202141/7 "2019-10-31T12:25:01Z")

</div>

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