# Remove a key that starts with 0 to 9

**URL:** https://discuss.elastic.co/t/remove-a-key-that-starts-with-0-to-9/272142
**Category:** Logstash
**Created:** [May 5, 2021, 7:49am UTC](https://discuss.elastic.co/t/remove-a-key-that-starts-with-0-to-9/272142 "2021-05-05T07:49:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mangeshmj1992](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@mangeshmj1992](https://discuss.elastic.co/u/mangeshmj1992)
#### Post date: [May 5, 2021, 7:49am UTC](https://discuss.elastic.co/t/remove-a-key-that-starts-with-0-to-9/272142/1 "2021-05-05T07:49:54Z")

</div>

Hello team,  
I need to Remove a field that starts with an integer. I am using logstash & kv filter to parse this logs. Can you please help me.

PFB sample log line:

`2021-01-07 05:32:31,761 Method=get call SoapAction="RiskDecision" MTCN=216 PCPNumber=890 SessionID=rt-yt ChannelVersion=123 12=878 38=980 045=118 230=7896`

I need to exclude 12, 38, 045 & 230 from key value pair. it should not be display in kibana.

I tried below script but it is not working. @Badger Can you please help on this.

```
ruby {
    code => "
    event.to_hash.keys.each { |k|
    if k.start_with?('0.','1.','2.')
      event.remove(k)
    end
    }
   "
   }
```

---

<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: [June 2, 2021, 7:50am UTC](https://discuss.elastic.co/t/remove-a-key-that-starts-with-0-to-9/272142/2 "2021-06-02T07:50:43Z")

</div>

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