# Wildcards in logstash remove\_field

**URL:** https://discuss.elastic.co/t/wildcards-in-logstash-remove-field/241644
**Category:** Logstash
**Created:** [July 17, 2020, 12:45pm UTC](https://discuss.elastic.co/t/wildcards-in-logstash-remove-field/241644 "2020-07-17T12:45:46Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Gauti](https://avatars.discourse-cdn.com/v4/letter/g/cdc98d/32.png) [@Gauti](https://discuss.elastic.co/u/Gauti)
#### Post date: [July 17, 2020, 4:52pm UTC](https://discuss.elastic.co/t/wildcards-in-logstash-remove-field/241644/3 "2020-07-17T16:52:51Z")

</div>

@Badger i tried to replicate the below ruby code,

> [@How to remove subfield using ruby](https://discuss.elastic.co/t/how-to-remove-subfield-using-ruby/68072):
>
> Hi , I am using ruby filter to remove fields that start with 'ID'. In the same way how can i remove subfield of a field called 'outputdata'. Below, code couldn't remove. ruby { code =\> " event.to\_hash.keys.each { |k| event.remove(k) if k.start\_with?('[outputdata.ID](http://outputdata.ID):') } Thank you

I used something like below and was getting error,

`ruby { code => 'event['result'].keys.each { |k| event['result'].remove(k) if k.end_with?('.value')' }`

can you provide some ruby code example for my scenario.

Thanks  
Gautham

---

_[View the full topic](https://discuss.elastic.co/t/wildcards-in-logstash-remove-field/241644)._
