# Importing ruby class fails in the ruby plugin

**URL:** <https://discuss.elastic.co/t/importing-ruby-class-fails-in-the-ruby-plugin/251281>\
**Category:** Logstash\
**Created:** [October 7, 2020, 2:01pm UTC](https://discuss.elastic.co/t/importing-ruby-class-fails-in-the-ruby-plugin/251281 "2020-10-07T14:01:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thdesy](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@thdesy](https://discuss.elastic.co/u/thdesy)\
**Post date:** [October 7, 2020, 2:01pm UTC](https://discuss.elastic.co/t/importing-ruby-class-fails-in-the-ruby-plugin/251281/1 "2020-10-07T14:01:36Z")

</div>

Hi all,

I am trying to use/offload some Ruby code in a filter to process XML events (due to various reasons, I have to move away from the XML input plugin).  
The problem is, that the import of 'nori' class fails within logstash/ruby, while the code etc. works fine in irb. When testing/running the grok, logstash throws an error that it could not load the 'nori' class (while other classes as for example 'nokigiri' can be imported)

```
logstash -f /etc/logstash/conf.d/111-filter-xml.conf -t
...
[ERROR] 2020-10-07 13:45:15.721 [LogStash::Runner] Logstash - java.lang.IllegalStateException: Logstash stopped processing because of an error: (LoadError) no such file to load -- nori

```

where I am just using the ruby plugin pointing to the scriptlet

```
filter {
   if "xml" in [tags] {
     ruby {
        path => "/etc/logstash/ruby.d/myxmlruby.rb"
     }
   }
}

```

where I can trigger the error from the scriptlet by just requiering nori

```
require 'nokogiri'
require "nori"

def register(params)
end

def filter(event)
    return [event]
end

```

I have already tried to install/uninstall the nori package from various sources (yum/rpm & gem).

Do I maybe have to setup the logstash ruby environment in some specific way to pick up the additional classes somehow?

Cheers and thanks for ideas,  
Thomas

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2020, 2:01pm UTC](https://discuss.elastic.co/t/importing-ruby-class-fails-in-the-ruby-plugin/251281/2 "2020-11-04T14:01:39Z")

</div>

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