# GeoIP enrich IP addresses broken if fileting with include\_fields

**URL:** <https://discuss.elastic.co/t/geoip-enrich-ip-addresses-broken-if-fileting-with-include-fields/346824>\
**Category:** Elastic Agent\
**Tags:** packetbeat\
**Created:** [November 9, 2023, 7:53pm UTC](https://discuss.elastic.co/t/geoip-enrich-ip-addresses-broken-if-fileting-with-include-fields/346824 "2023-11-09T19:53:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmgeurts](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dmgeurts/32/95115_2.png) [@dmgeurts](https://discuss.elastic.co/u/dmgeurts)\
**Post date:** [November 9, 2023, 7:53pm UTC](https://discuss.elastic.co/t/geoip-enrich-ip-addresses-broken-if-fileting-with-include-fields/346824/1 "2023-11-09T19:53:43Z")

</div>

I'm logging DNS packets without dns.response\_code: NOERROR. This part works fine.

But when I try to smile down the logged data, by adding a filter to drop all but some selected fields, GeoIP breaks. GeoIP can't be used in the Elastic Agent Packetbeat processor, so I'm a bit stuck without this as a workaround.

The following works fine:

```auto
- drop_event:
    when:
      equals:
        dns.response_code: NOERROR

```

And this works great for reducing the data volume, but breaks GeoIP too:

```auto
 include_fields:
    fields:
      - source
      - server.bytes
      - server.ip
      - dns.question.name
      - dns.question.type
      - dns.question.etld_plus_one
      - dns.response_code
      - network.transport
      - network.type

```

Is this a bug, or a feature?

I guess I could add the GeoIP data in Kibana, but I'd prefer to log the data properly in the first place.

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [November 10, 2023, 10:50pm UTC](https://discuss.elastic.co/t/geoip-enrich-ip-addresses-broken-if-fileting-with-include-fields/346824/2 "2023-11-10T22:50:23Z")

</div>

You are dropping the `source` object and the geoip processor makes use of the `source.ip` field so you will never get any `source.geo` info.

> <https://github.com/elastic/integrations/blob/9dcd6eac196eed413eff898c1ecbc46fe1d745e1/packages/network_traffic/data_stream/dns/elasticsearch/ingest_pipeline/geoip.yml#L5>

You could create an ingest pipeline named `logs-network_traffic.dns@custom` which would run after the geoip pipeline to drop the `source` field. Fleet will automatically invoke your custom pipeline at the end of the built-in one.

 ![Screenshot 2023-11-10 at 17.45.56](https://us1.discourse-cdn.com/elastic/original/3X/f/6/f6de352cd3d056275e777b8f97ce9ae50596110d.png)

---

<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 8, 2023, 10:51pm UTC](https://discuss.elastic.co/t/geoip-enrich-ip-addresses-broken-if-fileting-with-include-fields/346824/3 "2023-12-08T22:51:01Z")

</div>

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