# Grok filter only uses last match, can this be changed?

**URL:** <https://discuss.elastic.co/t/grok-filter-only-uses-last-match-can-this-be-changed/67208>\
**Category:** Logstash\
**Created:** [November 25, 2016, 4:57pm UTC](https://discuss.elastic.co/t/grok-filter-only-uses-last-match-can-this-be-changed/67208 "2016-11-25T16:57:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arthur\_Francis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arthur_francis/32/13065_2.png) [@Arthur\_Francis](https://discuss.elastic.co/u/Arthur_Francis)\
**Post date:** [November 25, 2016, 4:57pm UTC](https://discuss.elastic.co/t/grok-filter-only-uses-last-match-can-this-be-changed/67208/1 "2016-11-25T16:57:52Z")

</div>

If a pattern is matched several times within an event, is there a way to take into account only the first match. After doing some testing after my issue in this post here [Grok filter behaviour different for some messages](https://discuss.elastic.co/t/grok-filter-behaviour-different-for-some-messages/66078)

I found that only the last match is included in the result, is there a way to reference the index of the matches somehow or change this default behaviour?

Thanks

---

<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 23, 2016, 4:57pm UTC](https://discuss.elastic.co/t/grok-filter-only-uses-last-match-can-this-be-changed/67208/2 "2016-12-23T16:57:52Z")

</div>

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