Java Filter For Logstash

我只是一个虾纸丫 提交于 2019-12-04 02:58:48

So to answer this, I found this wonderful tutorial from Elastc.co:

Shows the steps to create a new gem and use it as a filter for Logstash later on.

https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!