Remove a key that starts with 0 to 9

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
    }
   "
   }

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