Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
Created July 11, 2020 11:27
Show Gist options
  • Save wshihadeh/ecb7ea8dce66f81586bc00ecb21b7448 to your computer and use it in GitHub Desktop.
Save wshihadeh/ecb7ea8dce66f81586bc00ecb21b7448 to your computer and use it in GitHub Desktop.
<match pattern>
@type key_value_parser
key log
remove_key true
remove_prefix /^[^ ]+\s[^ ]+/
use_regex true
filtered_keys none
filtered_keys_regex /^sub_[a-zA-Z_0-9]+/
</match>
## Input Data
{
'time' => '2013-02-12 22:01:15 UTC',
'log' => "Start Request sub_key=0 sub_akey=11 sub_zkey=12 key=10 gkey=100 nkey=108 skey='this is a miltispace line' akey=20 zkey=30 dkey=4"
}
## Output Data
{
"time"=>"2013-02-12 22:01:15 UTC",
"sub_key"=>"0",
"sub_akey"=>"11",
"sub_zkey"=>"12"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment