Creating an output plugin -- guide not working


(Mjnorman) #1

Hello all. I am attempting to update an older plugin with the assistance of the original developer. We are both fairly new to Ruby, so keep that in mind while reading the below. At first I attempted to work with the existing plugin (was coded for logstash v2. After not being very successful here, I attempted to just start from scratch and see if I could get a standard freshly built output plugin built and working.

System is Windows 10
jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.111-b14 on 1.8.0_111-b14 +jit [mswin32-x86_64]

I am attempting to follow the guide here, https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_output_plugin.html

Steps to recreate:

Download logstash 6.4.1.zip extract.
Using the bin/logstash-plugin module, I created the output plugin, no issues. Modify the gemspec file to include some test summary/description.
Add gem "logstash", :github => "elastic/logstash", :branch => "6.4" to Gemfile as per directions. However this didn't work so I had to change to logstash-core, doc out of date?
No other code changes.
Push to github
Move to new directory
git clone mytestplugin
bundle install (no issues)
bundle exec rspec (this reports 0 examples, 0 failures)
Also tried bundle exec rspec spec gives the below error:
missing class name (org.logstash.RubyUtil')`

At this point the guide is telling me I should have found the 1 test in the file, but it is not. Or with rspec spec it does find the test but has some error.

I am able to build the gem here, but something is not right and I want to be sure that I get this right from the get go. Apologies for the long winded post, but I wanted to give as much info as possible. You can find the test repo here.

Thanks for any help you can give.


(Mjnorman) #2

Any help here?


(Mjnorman) #3

Is this the proper forum for this report? If not can someone tell me where I can get some help with this?

The exact error when following the guide is below--

`Failure/Error: # encoding: utf-8

RuntimeError:

    you might need to reinstall the gem which depends on the missing jar or in case there is Jars.lock then resolve the jars with lock_jars command

no such file to load -- org/apache/logging/log4j/log4j-core/compile/log4j-core-compile-2.6.2 (LoadError)

./spec/outputs/mytestseq_spec.rb:1:in (root)'

./spec/outputs/mytestseq_spec.rb:2:in (root)'

c:\jruby-9.2.0.0\bin\rspec:23:in `'

------------------

--- Caused by: ---

LoadError:

no such file to load -- org/apache/logging/log4j/log4j-core/compile/log4j-core-compile-2.6.2

./spec/outputs/mytestseq_spec.rb:1:in (root)'

No examples found.

Finished in 0.007 seconds (files took 0.928 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
`


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.