# Drop ipv6 from metricbeat data

**URL:** <https://discuss.elastic.co/t/drop-ipv6-from-metricbeat-data/297158>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 14, 2022, 3:02pm UTC](https://discuss.elastic.co/t/drop-ipv6-from-metricbeat-data/297158 "2022-02-14T15:02:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adriann](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adriann/32/77780_2.png) [@Adriann](https://discuss.elastic.co/u/Adriann)\
**Post date:** [February 14, 2022, 3:02pm UTC](https://discuss.elastic.co/t/drop-ipv6-from-metricbeat-data/297158/1 "2022-02-14T15:02:01Z")

</div>

Hello,

I want to drop ipv6 address from metricbeat host.ip document values.

How can I do that?

I am on 7.16-2

---

<div class="post-metadata">

**Author:** ![Andrea\_Spacca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrea_spacca/32/76976_2.png) [@Andrea\_Spacca](https://discuss.elastic.co/u/Andrea_Spacca)\
**Post date:** [February 16, 2022, 3:18pm UTC](https://discuss.elastic.co/t/drop-ipv6-from-metricbeat-data/297158/2 "2022-02-16T15:18:01Z")

</div>

Hello @Adriann

you could add a script processor in the ingestion pipeline:

```auto
            ArrayList ipv4 = new ArrayList();
            for (int i = 0; i < ctx.host?.ip?.length; ++i) {
              if (!ctx.host.ip[i].contains(":")) {
                  ipv4.add(ctx.host.ip[i]);
              }
            }
            ctx.host.ip = ipv4;

```

---

<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 16, 2022, 5:18pm UTC](https://discuss.elastic.co/t/drop-ipv6-from-metricbeat-data/297158/3 "2022-03-16T17:18:29Z")

</div>

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