# Create field if it's not equal "Undefined"

**URL:** <https://discuss.elastic.co/t/create-field-if-its-not-equal-undefined/25718>\
**Category:** Logstash\
**Created:** [July 16, 2015, 11:28am UTC](https://discuss.elastic.co/t/create-field-if-its-not-equal-undefined/25718 "2015-07-16T11:28:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 16, 2015, 11:28am UTC](https://discuss.elastic.co/t/create-field-if-its-not-equal-undefined/25718/1 "2015-07-16T11:28:39Z")

</div>

Hi!  
I have logs:  
days\_in\_game: 198; pvp\_rating: 63; provider: Undefined;  
And i want to crete field "provider" in documents when it's not equal "Undefined".  
Can you write me filter config for this?  
THX!

---

<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:** [July 16, 2015, 11:48am UTC](https://discuss.elastic.co/t/create-field-if-its-not-equal-undefined/25718/2 "2015-07-16T11:48:44Z")

</div>

Use a [csv filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-csv.html) to parse the message into (in your example) three fields, then use a [conditional](https://www.elastic.co/guide/en/logstash/current/configuration.html#conditionals) to selectively include a [mutate filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-csv.html) that drops the `provider` field if it's "Undefined".

---

<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:** [July 6, 2017, 5:34am UTC](https://discuss.elastic.co/t/create-field-if-its-not-equal-undefined/25718/3 "2017-07-06T05:34:30Z")

</div>

Closed on July 6, 2017, 5:34am UTC


