# Logstash Dissect Filter

**URL:** <https://discuss.elastic.co/t/logstash-dissect-filter/104907>\
**Category:** Logstash\
**Created:** [October 23, 2017, 2:14pm UTC](https://discuss.elastic.co/t/logstash-dissect-filter/104907 "2017-10-23T14:14:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maddie0726](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@maddie0726](https://discuss.elastic.co/u/maddie0726)\
**Post date:** [October 23, 2017, 2:14pm UTC](https://discuss.elastic.co/t/logstash-dissect-filter/104907/1 "2017-10-23T14:14:42Z")

</div>

I have Logstash Kibana and Elasticsearch versions 5.6.2 installed on Windows 2012 R2. I have a grok pattern that reads in text file entries adequately. The end of each entry is a message field containing a couple different formats; sometimes an IP adress, sometimes 2 IP addresses and different messages attached. What I need is to pull only the entries that have an outside IP address and I need to pull that IP address and put it in a field and use it as the source for geoIP. I was thinking of using the dissect filter in an if statement to weed out the entries that do not have an outside IP address. I don't know if I can/how to use the dissect filter on literal message text (unstructured) to pull just one IP address (sometimes there are 2 IP addresses).

Some example messages (parsed in to a greedydata field using a grok filter):

UDP request discarded from 00.00.000.00/000 to outside:000.0.0.0/00  
Built dynamic UDP translation from COVERT:00.00.00.00/0000 to outside:00.00.0.000/00000  
Teardown UDP connection 560221 for outside:00.000.0.0/00 to COVERT:00.00.00.00/00000 duration 0:00:00 bytes 200  
Built local-host outside:00.000.00.00

Thanks in advance!

---

<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:** [October 23, 2017, 8:21pm UTC](https://discuss.elastic.co/t/logstash-dissect-filter/104907/2 "2017-10-23T20:21:05Z")

</div>

Why not use a grok filter?

```nohighlight
grok {
  match => ["message", "\boutside:%{IP:ip}\b"]
  tag_on_failure => []
}
if [ip] {
  geoip {
    ...
  }
}

```

---

<div class="post-metadata">

**Author:** ![maddie0726](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@maddie0726](https://discuss.elastic.co/u/maddie0726)\
**Post date:** [October 23, 2017, 8:28pm UTC](https://discuss.elastic.co/t/logstash-dissect-filter/104907/3 "2017-10-23T20:28:39Z")

</div>

Would this be a grok within my first grok? And what would go in the if statement?

---

<div class="post-metadata">

**Author:** ![maddie0726](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@maddie0726](https://discuss.elastic.co/u/maddie0726)\
**Post date:** [October 23, 2017, 8:36pm UTC](https://discuss.elastic.co/t/logstash-dissect-filter/104907/4 "2017-10-23T20:36:30Z")

</div>

I got it, thank you!

---

<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:** [November 20, 2017, 8:36pm UTC](https://discuss.elastic.co/t/logstash-dissect-filter/104907/5 "2017-11-20T20:36:31Z")

</div>

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