# IF geoip.country\_name - country\_name

**URL:** <https://discuss.elastic.co/t/if-geoip-country-name-country-name/129151>\
**Category:** Logstash\
**Created:** [April 23, 2018, 5:08pm UTC](https://discuss.elastic.co/t/if-geoip-country-name-country-name/129151 "2018-04-23T17:08:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GlennH](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@GlennH](https://discuss.elastic.co/u/GlennH)\
**Post date:** [April 23, 2018, 5:08pm UTC](https://discuss.elastic.co/t/if-geoip-country-name-country-name/129151/1 "2018-04-23T17:08:42Z")

</div>

I am trying to create a IF statement using country\_name for an email output although it is not identifying the field. I have tried geoip.country\_name as well.

Has anyone used geoip.country\_name to filter in logstash?

```
output {
     if "Exchange" in [tags] and "_geoip_lookup_failure" not in [tags] and "United States" not in [country_name]{
    email {
      to => 'name@domain'
      from => 'kibana@domain.net'
      subject => 'Non US Exchange Access %{country_name} %{AuthenticatedUser}'
      body => "%{message}"
      domain => 'mail.domain.net'
      port => 25
    }
      }
    }
```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 23, 2018, 6:37pm UTC](https://discuss.elastic.co/t/if-geoip-country-name-country-name/129151/2 "2018-04-23T18:37:00Z")

</div>

> [@GlennH](#):
>
> geoip.country\_name

That should be [geoip][country\_name]

---

<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:** [May 21, 2018, 6:37pm UTC](https://discuss.elastic.co/t/if-geoip-country-name-country-name/129151/3 "2018-05-21T18:37:02Z")

</div>

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