# Why is date filter in Logstash used?

**URL:** <https://discuss.elastic.co/t/why-is-date-filter-in-logstash-used/107549>\
**Category:** Logstash\
**Created:** [November 14, 2017, 1:01pm UTC](https://discuss.elastic.co/t/why-is-date-filter-in-logstash-used/107549 "2017-11-14T13:01:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amruth](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@amruth](https://discuss.elastic.co/u/amruth)\
**Post date:** [November 14, 2017, 1:01pm UTC](https://discuss.elastic.co/t/why-is-date-filter-in-logstash-used/107549/1 "2017-11-14T13:01:48Z")

</div>

I am extracting fields from grok expression out of which one field is a timestamp field. Later I am using date filter and matching with timestamp field. But the problem is timestamp field is not consistent always. It may be 2017-11-13 12:53:22.123456 or it may be 2017-11-13 12:53:22.1234. What should I do in this case?

Also if I am not wrong, date flter is used to convert a field from string to date type?

Please suggest me..

---

<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:** [November 14, 2017, 2:07pm UTC](https://discuss.elastic.co/t/why-is-date-filter-in-logstash-used/107549/2 "2017-11-14T14:07:53Z")

</div>

You can list multiple date patterns in a single date filter.

---

<div class="post-metadata">

**Author:** ![amruth](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@amruth](https://discuss.elastic.co/u/amruth)\
**Post date:** [November 14, 2017, 2:24pm UTC](https://discuss.elastic.co/t/why-is-date-filter-in-logstash-used/107549/3 "2017-11-14T14:24:34Z")

</div>

Exact pattern would be 2017-11-13 21:30:48:48319. What changes is just the milli second part. It may be 6 digits, 4 digits. So can I just use following,

```
date {
                                match => ["timestamp", "ISO8601"]
                                target => "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:** [December 12, 2017, 2:24pm UTC](https://discuss.elastic.co/t/why-is-date-filter-in-logstash-used/107549/4 "2017-12-12T14:24:36Z")

</div>

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