Create a new field with ruby filter

grok { match => { "request" => [ "url", "%{URIPATH:url_path}%{URIPARAM:url_params}?" ]} }
  urldecode{ field => "url_path" }
  mutate { gsub =>  ["url_params","\?","" ] }
  kv {
    field_split => "&"
    source => "url_params"
    target => "params"
  }
  urldecode{ field => "params" }
  
  ruby {
    code => 'pattern= params.keys.join(",")'
    #Pattern should be the new field that contains the key, separated by comma
  }

So here the params is a hash, and I would like to concat all of the keys and store it to a new field, how can I achieve that?

@thelfter, you can use event.set('field_name', field_value) within a Ruby filter to create a new field and set its value.

1 Like

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