I have a log file in json format having values and corresponding sub-values till 2 levels. All are encapsulated with double quotes. Normally the log is having simple key-value pairs having key and values encapsulated within double quotes but sometimes i get exceptions like given below with sub-values . This is causing parsing issues and i used mutate with gsub like this :
mutate {
gsub => ["json_part", '" """', '" "``' , "json_part", '""" "', '``" "', "json_part", '""', '``']
}
Using above gsub, below lines is not parsed correctly :
"jobName" "do" "command" "env SimuType=rtl VIP_AMBA=0 XPROP=0 TEAL_TARMAC_ENABLE=never xrun -64bit -r DEFAULT_RTL "" """ "ru_utime" "0.860498"
Please note that keys above are jobName, command & ru_utime.
This below log line is parsed correctly with above gsub.
"cpuTime" "14261.006836" "command" """exec"" ""/bin/sh"" ""/home/evinc/F8-80/OPT3/wrapper.sh"" ""1
"" ""0"" ""deckbuild"" ""-noplot"" ""-vwf2"" ""-ascii"" ""-run"" ""/home/evinc/F8-80/OPT3/jobs/3534/3535/3575/3576/3577/deck-ml.in""" "ru_utime" "14261.002999"
keys in above log are cpuTime, command, ru_utime
I want to know how gsub parse the log in case of multiple pattern in the array? Is it from left to right in sqeuence or right to left or if only one matches then gsub stops and applies the replacement string i.e From my given gsub
"json_part", '""', '``' is executed first or "json_part", '" """', '" "``'
?
For me it is not that important to have sub-values. My final requirement is to have maintain key, value and keep/change sub-values encapsulation.
Please suggest.