# How can I remove unwanted parameters in logstash geoip

**URL:** <https://discuss.elastic.co/t/how-can-i-remove-unwanted-parameters-in-logstash-geoip/215673>\
**Category:** Logstash\
**Created:** [January 20, 2020, 6:53am UTC](https://discuss.elastic.co/t/how-can-i-remove-unwanted-parameters-in-logstash-geoip/215673 "2020-01-20T06:53:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruranga](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@ruranga](https://discuss.elastic.co/u/ruranga)\
**Post date:** [January 20, 2020, 6:53am UTC](https://discuss.elastic.co/t/how-can-i-remove-unwanted-parameters-in-logstash-geoip/215673/1 "2020-01-20T06:53:37Z")

</div>

Hi,  
Actually I don't need following parameters in logstash geoip out put  
geoip.city\_name  
geoip.continent\_code  
geoip.dma\_code  
geoip.ip  
geoip.latitude  
geoip.location.lat  
geoip.location.lon  
geoip.longitude  
geoip.postal\_code  
geoip.region\_code  
geoip.region\_name  
geoip.timezone

I only need  
geoip.country\_code2  
geoip.country\_code3  
geoip.country\_name

how can i perform this in logstash filter{}

Thanks in adavcne!

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [January 20, 2020, 2:37pm UTC](https://discuss.elastic.co/t/how-can-i-remove-unwanted-parameters-in-logstash-geoip/215673/2 "2020-01-20T14:37:41Z")

</div>

Hi there,

you can either remove the unwanted fields, like:

```
filter {
  mutate {
    remove_field => ["[geoip][city_name]", "[geoip][continent_code]" ...]
  }
}

```

or saving the values you're interested in in another field, replace the geoip field with this new one, and then remove the new field like:

```
filter {
  mutate {
    copy => { "[geoip][city_name]" => "[new_geoip][city_name]" }
    copy => { "[geoip][code1]" => "[new_geoip][code1]" }
    copy => { "[new_geoip]" => "[geoip]" }
    remove_field => ["[new_geoip]" ]
  }
}

```

Guess it depends on how many fields you want to keep out of how many they are in total.

---

<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:** [February 17, 2020, 2:37pm UTC](https://discuss.elastic.co/t/how-can-i-remove-unwanted-parameters-in-logstash-geoip/215673/3 "2020-02-17T14:37:45Z")

</div>

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