After upgrade Logstash 2.3 tries to evaluate $1 enviroment-var in embedded ruby code


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
              event[k0] = v0

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?

This is a known issue, we're working on having a fix for it ASAP.
You may need to downgrade to get around this unfortunately :frowning:

I ran into this issue as well. Had to downgrade from 2.3.0-1 in the apt repo using the 2.3.3-1 .deb file manually.

Would love to see a quick fix for this and older versions maintained in the apt repo for quick version downgrading and pinning when needed.