Ruby does not execute require inside logstash


(Marco) #1

I have installed logstash the moment to execute require 'jdbc / mysql' the the following error appears:
[ERROR] [logstash.filters.ruby] Ruby exception occurred: no such file to load - jdbc / mysql

Please your help I do not know how to make it work


(Magnus Bäck) #2

Do you really have spaces on each side of the slash?

Also, are you sure the jdbc-mysql gem is available in your Logstash installation?


(Marco) #3

By mistake I write it with spaces
Part of my code in logstash:

input {
udp {
port => 5965
codec => plain { charset => "UTF-8" }
type => "TextEvent"
}
}

filter {
if [type] == "TextEvent" {
ruby {
code => "
require 'rubygems'
require 'java'
require 'base64'
require 'openssl'
require 'inifile'
require 'jdbc/mysql'

when reviewing the log it appears:
[2018-07-16T07:58:38,242][ERROR][logstash.filters.ruby ] Ruby exception occurred: no such file to load -- jdbc/mysql

the gems installed

*** LOCAL GEMS ***

actioncable (5.2.0)
actionmailer (5.2.0)
actionpack (5.2.0)
actionview (5.2.0)
activejob (5.2.0)
activemodel (5.2.0)
activerecord (5.2.0)
activestorage (5.2.0)
activesupport (5.2.0)
arel (9.0.0)
base (0.0.2)
bigdecimal (1.2.8)
builder (3.2.3)
bundle (0.0.1)
bundler (1.16.2)
concurrent-ruby (1.0.5)
crass (1.0.4)
did_you_mean (1.0.0)
erubi (1.7.1)
globalid (0.4.1)
i18n (1.0.1)
inifile (3.0.0)
io-console (0.4.5)
jdbc-mysql (5.1.46)
json (1.8.3)
loofah (2.2.2)
mail (2.7.0)
marcel (0.3.2)
method_source (0.9.0)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.8.3)
mysql (2.9.1)
mysql2 (0.5.2)
net-telnet (0.1.1)
nio4r (2.3.1)
nokogiri (1.8.4)
openssl (2.1.1)
power_assert (0.2.6)
psych (2.0.17)
rack (2.0.5)
rack-test (1.0.0)
rails (5.2.0)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.4)
railties (5.2.0)
rake (10.4.2)
rdoc (4.2.1)
ruby-mcrypt (0.2.0)
rubysl-base64 (2.0.0)
sprockets (3.7.2)
sprockets-rails (3.2.1)
test-unit (3.1.5)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
websocket-driver (0.7.0)
websocket-extensions (0.1.3)

I tried everything, uninstall ruby again, but nothing


(Magnus Bäck) #4

Then I don't know what's going on. Sorry.


(system) #5

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