Hallo,
I am using ruby code in Logstash in the kind:
ruby { code => "
b = { 'K' => 1024.0, 'M' => 1048576.0, 'G' => 1073741824.0 }
event['z0'].each do | k0, v0 |
if (v0 =~ /^[\-\+0-9]/)
factor = 1
factor = b[$1] if (v0 =~ /[0-9]([KMG])B$/)
event[k0] = v0.to_f * factor
else
event[k0] = v0
end
end
"}
After upgrading to Logstash 2.3 it stops with the message:
....:reason=>"Cannot evaluate $1
. Environment variable 1
is not set and there is no default value given.", :level=>:error}.
Is there a way to prevent Logstash from investigating environment vars in ruby code - e.g. by escaping $1, but so that it still works in ruby?