# Match all Random IP Addresses

**URL:** <https://discuss.elastic.co/t/match-all-random-ip-addresses/118648>\
**Category:** Logstash\
**Created:** [February 6, 2018, 1:01pm UTC](https://discuss.elastic.co/t/match-all-random-ip-addresses/118648 "2018-02-06T13:01:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjvermeulen](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@cjvermeulen](https://discuss.elastic.co/u/cjvermeulen)\
**Post date:** [February 6, 2018, 1:01pm UTC](https://discuss.elastic.co/t/match-all-random-ip-addresses/118648/1 "2018-02-06T13:01:40Z")

</div>

Sorry if this a total rookie question but..  
**Scenario** : I have random multiline log messages that have anywhere from 1 to 100 IP addresses in them. The IP's are sporadic and don't always follow a single pattern. Ie. They don't always follow a single comma, etc.

**Goal** : Match all IP's and output them to a single field as an array.

**Question** : Using a grok filter I can match the first result but it then stops processing. Is there an easy way to match each IP without having 100 match statements and 100 fields?

**Thoughts** : loop the single match statements? Output the original message to a new field and then use mutate to remove anything that **doesn't** match an IP.

Any insight is appreciated.

Thanks!

(Apologies for bad formating, I'm writing this from my mobile)

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 6, 2018, 1:24pm UTC](https://discuss.elastic.co/t/match-all-random-ip-addresses/118648/2 "2018-02-06T13:24:33Z")

</div>

Does [this open issue](https://github.com/logstash-plugins/logstash-filter-grok/issues/86) match what you are looking for?

---

<div class="post-metadata">

**Author:** ![cjvermeulen](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@cjvermeulen](https://discuss.elastic.co/u/cjvermeulen)\
**Post date:** [February 6, 2018, 5:40pm UTC](https://discuss.elastic.co/t/match-all-random-ip-addresses/118648/3 "2018-02-06T17:40:14Z")

</div>

It reads like it. Thanks!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 6, 2018, 6:11pm UTC](https://discuss.elastic.co/t/match-all-random-ip-addresses/118648/4 "2018-02-06T18:11:50Z")

</div>

Unfortunately that means it is currently not possible, so you may need to use a ruby filter.

---

<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:** [March 6, 2018, 6:12pm UTC](https://discuss.elastic.co/t/match-all-random-ip-addresses/118648/5 "2018-03-06T18:12:18Z")

</div>

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