Trying to build a gem to use it for Logstash as a filter. I'm using classes and methods from a .jar file.
The following is my Jruby code so far:
require 'java' require 'Processing.jar' $CLASSPATH << 'lib' class LogStash::Filters::Processing < LogStash::Filters::Base config_name "process" score = JavaUtilities.get_proxy_class('process.Process') @score = score.new ("/path/") public def register end public def filter(event) if @text event["NewField"] = @score.myMethod(event[@text]) end filter_matched(event) end end
However, it gave me the following error:
undefined local variable or method score.myMethod(event["text"])
So, I tried the following:
. . . public def filter(event) score = JavaUtilities.get_proxy_class('process.Process') @score = score.new ("/path/") event["NewField"] = @score.myMethod(@text) filter_matched(event) end end
But it gave me the error:
> SyntaxError: dynamic constant assignment error.
Please note that I tried this in a normal jruby file and everything worked with me. Using Logstash's filter however is what seems to be giving me an issue here.. Any help? PLEASE!!!