# Date filter question - what happens if two formats match?

**URL:** <https://discuss.elastic.co/t/date-filter-question-what-happens-if-two-formats-match/24509>\
**Category:** Logstash\
**Created:** [June 28, 2015, 3:13pm UTC](https://discuss.elastic.co/t/date-filter-question-what-happens-if-two-formats-match/24509 "2015-06-28T15:13:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GordonM](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@GordonM](https://discuss.elastic.co/u/GordonM)\
**Post date:** [June 28, 2015, 3:13pm UTC](https://discuss.elastic.co/t/date-filter-question-what-happens-if-two-formats-match/24509/1 "2015-06-28T15:13:23Z")

</div>

If date {} ‘s match method is used, and multiple formats are supplied to match against, what happens if more than one format matches? Does it just use the first match made, the last match made, or something else?

date {  
match =\> ["timestamp", "format1", "format2"]  
}

(Both format 1 and format 2 match.)

---

<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:** [June 28, 2015, 8:21pm UTC](https://discuss.elastic.co/t/date-filter-question-what-happens-if-two-formats-match/24509/2 "2015-06-28T20:21:34Z")

</div>

The patterns are tried in order and the first match wins.

> <https://github.com/logstash-plugins/logstash-filter-date/blob/v1.0.0/lib/logstash/filters/date.rb#L221-L232>

---

<div class="post-metadata">

**Author:** ![GordonM](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@GordonM](https://discuss.elastic.co/u/GordonM)\
**Post date:** [June 28, 2015, 11:24pm UTC](https://discuss.elastic.co/t/date-filter-question-what-happens-if-two-formats-match/24509/3 "2015-06-28T23:24:57Z")

</div>

Thank you, and especially for taking the time to get the code showing it.

---

<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:** [July 6, 2017, 5:36am UTC](https://discuss.elastic.co/t/date-filter-question-what-happens-if-two-formats-match/24509/4 "2017-07-06T05:36:13Z")

</div>

Closed on July 6, 2017, 5:36am UTC


