Hi,
I`m new to Logstash and Ruby.
Would like to get help.
Currently I have a data as below
test:result testcase: #TEMP_BTWLAN:ok; loop:24;Temperature:28;
My initial target is by using ruby to generate as below Output.
test => result testcase
TEMP_BTWLAN => ok
loop => 24
Temperature => 28
Below is my code
#using kv to split the message
kv {
source => "message"
field_split => ";"
value_split => ":"
}
ruby {
code => "
hash = event.to_hash
hash.each { |key, value|
if value.include? '"'
event.set(key, value.gsub!('"', ''))
end
}
"
}
Output as below:
test => result testcase: #TEMP_BTWLAN:ok <== Problem
loop => 24
Temperature => 28
How to solve Problem that I stated above?