I have a string which is dynamic .It represents resp time and ip address
60.006,0.001#10.10.24.14:8082,10.10.22.11:8082
The no of machine can grow and so will the subsequent resp time and ip address.
What I am trying is to split the string first on the basis of '#' and then on the basis of ',' and store the values. The code I have written in ruby is
ruby {
code => "
fields = event['data'].split('#')
for field in fields
field = field.split(',')
event['respTime1'] = field[0]
event['respTime2'] = field[1]
end
"
}
Can someone explain or tell how to make the fields dynamic so that if I have 100 different servers resp time & IP address, I can use dynamic names for it