# How to remove a field

**URL:** <https://discuss.elastic.co/t/how-to-remove-a-field/39746>\
**Category:** Logstash\
**Created:** [January 21, 2016, 9:41am UTC](https://discuss.elastic.co/t/how-to-remove-a-field/39746 "2016-01-21T09:41:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sampasei](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sampasei](https://discuss.elastic.co/u/sampasei)\
**Post date:** [January 21, 2016, 9:41am UTC](https://discuss.elastic.co/t/how-to-remove-a-field/39746/1 "2016-01-21T09:41:17Z")

</div>

Hi all,  
i have a log (txt) file like this one:

```
#fields ts proto trans_id test test2
1453139999.678755 udp 43124 - -

```

Each field is tab separated. Using a grock filter i can take the field values, but i'm not able to remove a field if its value is equal to "-" (like test and test2 in the example above).  
How can i do this?  
thanks

---

<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:** [January 21, 2016, 6:48pm UTC](https://discuss.elastic.co/t/how-to-remove-a-field/39746/2 "2016-01-21T18:48:04Z")

</div>

[https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html)

```auto
filter {
  if [name-of-field] == "-" {
    mutate {
      remove_field => ["name-of-field"]
    }
  }
}

```

---

<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:14am UTC](https://discuss.elastic.co/t/how-to-remove-a-field/39746/3 "2017-07-06T05:14:54Z")

</div>


