Logstash STOMP input plugin throws error

Hi there!

I'm having an issue using Logstash STOMP input plugin. When running my configuration file, i get this error and don't have any on why I get it:

 Pipeline error {:pipeline_id=>"server05", :exception=>#<NameError: uninitialized class variable @@schemes in URI
Did you mean?  scheme_list>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/onstomp-1.0.12/lib/onstomp/components/uri.rb:28:in `<module:URI>'", "/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/onstomp-1.0.12/lib/onstomp/components/uri.rb:27:in `<main>'", "org/jruby/RubyKernel.java:1071:in `require'", "/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/onstomp-1.0.12/lib/onstomp/components.rb:7:in `<main>'", "org/jruby/RubyKernel.java:1071:in `require'", "/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/onstomp-1.0.12/lib/onstomp.rb:157:in `<main>'", "org/jruby/RubyKernel.java:1071:in `require'", "/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-input-stomp-3.0.8/lib/logstash/inputs/stomp.rb:63:in `register'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:237:in `block in register_plugins'", "org/jruby/RubyArray.java:1989:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:236:in `register_plugins'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:395:in `start_inputs'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:320:in `start_workers'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:194:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:146:in `block in start'"], "pipeline.sources"=>["/dsimonitor_logstash/logstash/config/di-logstash-sample.conf", "/dsimonitor_logstash/logstash/config/logstash-sample.conf"], :thread=>"#<Thread:0x44b8fd97 /usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:134 run>"}

Can you help please?
This is my input configuration:

input {
	stomp {                                               
		host => "server.com"
		port => 46613
		destination => "/topic/myTopic"
		user => "user"
		password => "password"
		codec => plain { charset => "Windows-1252" }
		tags => ["my_events"]

The stomp input has not been modified for years and it is not supported by the current ruby version. If the stomp input were packaged properly then I would expect the gem dependency checking would tell you exactly what the mismatch is, but unfortunately it does not.

The issue is that the stomp input wants to add support for stomp URIs (e.g. URIs that look like "stomp://user:password@host:port/destination" ). A long time ago that was done by adding the URI type to the @@schemes class variable in the URI class.

In 2021 ruby changed to providing a method to register a new URI scheme.

Here is an example of the old method, this an example of the new. (I think both of those are official ruby documentation.)

It would be trivial to fix the stomp input code here, but you would have to build the input locally, I don't think the onstomp gem is still maintained.

1 Like

Thanks a lot for your quick reply @Badger.
I'm not sure I'd like to maintain the plugin by my self. Do you have another plugin to suggest to me that would do roughly the same thing?

You would need something that speaks the STOMP protocol. If I had to do this I would insert another message broker in front of the STOMP source that can convert the messages to something logstash can ingest. Take a look at ActiveMQ, OpenMQ, or RabbitMQ.

1 Like

That's what I thought. I was thinking about Kafka or RabbitMQ.
Thanks again for your response.

If you can replace what you are using with Kafka or RabbitMQ, I would suggest to use Kafka as it seems to have a better support in the tools in the stack.

1 Like

Thanks a lot @leandrojmp