# Removing fields with certain value (or if mapping is not found) from the output

**URL:** https://discuss.elastic.co/t/removing-fields-with-certain-value-or-if-mapping-is-not-found-from-the-output/180941
**Category:** Logstash
**Created:** [May 14, 2019, 7:43am UTC](https://discuss.elastic.co/t/removing-fields-with-certain-value-or-if-mapping-is-not-found-from-the-output/180941 "2019-05-14T07:43:30Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [May 14, 2019, 12:21pm UTC](https://discuss.elastic.co/t/removing-fields-with-certain-value-or-if-mapping-is-not-found-from-the-output/180941/2 "2019-05-14T12:21:49Z")

</div>

```
ruby {
    code => '
        event.to_hash.each { |k, v|
            if v.to_s.start_with?("%{[theXML]")
                event.remove(k)
            end
        }
    '
}
```

---

_[View the full topic](https://discuss.elastic.co/t/removing-fields-with-certain-value-or-if-mapping-is-not-found-from-the-output/180941)._
