# RUBY Logstash Remove field without suffix

**URL:** <https://discuss.elastic.co/t/ruby-logstash-remove-field-without-suffix/146132>\
**Category:** Logstash\
**Created:** [August 27, 2018, 8:41am UTC](https://discuss.elastic.co/t/ruby-logstash-remove-field-without-suffix/146132 "2018-08-27T08:41:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnodl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arnodl/32/48837_2.png) [@Arnodl](https://discuss.elastic.co/u/Arnodl)\
**Post date:** [August 27, 2018, 8:41am UTC](https://discuss.elastic.co/t/ruby-logstash-remove-field-without-suffix/146132/1 "2018-08-27T08:41:42Z")

</div>

Hey.  
I need to write a filter in the logstash which deletes all fields except Hostname and Username and all fields with suffix and \_key, for example platform\_txt

---

<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:** [August 27, 2018, 9:34am UTC](https://discuss.elastic.co/t/ruby-logstash-remove-field-without-suffix/146132/2 "2018-08-27T09:34:48Z")

</div>

Have a look at the prune filter.

---

<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:** [September 24, 2018, 9:34am UTC](https://discuss.elastic.co/t/ruby-logstash-remove-field-without-suffix/146132/3 "2018-09-24T09:34:50Z")

</div>

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