Java Filter For Logstash

后端 未结 2 772
难免孤独
难免孤独 2021-02-20 11:00

You know how there is a Ruby filter for Logstash which enables me to write code in Ruby and it is usually included in the config file as follows

filter {
      r         


        
2条回答
  •  暖寄归人
    2021-02-20 11:53

    Orrr to answer your original question,

    you can include a JAR in your ruby code, but you need to be using jruby,

    see instructions here on how to access java code from JARs in JRuby:

    https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby#from-jar-files

    To use resources within a jar file from JRuby, the jar file must either be on the classpath or be made available with the require method:

    require 'path/to/mycode.jar' This require makes the resources in mycode.jar discoverable by later commands like import and include_package.

    Note that loading jar-files via require searches along the $LOAD_PATH for them, like it would for normal ruby files.

提交回复
热议问题