# Logstash exec ruby script in docker

**URL:** <https://discuss.elastic.co/t/logstash-exec-ruby-script-in-docker/362895>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [July 10, 2024, 3:11pm UTC](https://discuss.elastic.co/t/logstash-exec-ruby-script-in-docker/362895 "2024-07-10T15:11:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maeris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maeris/32/123964_2.png) [@Maeris](https://discuss.elastic.co/u/Maeris)\
**Post date:** [July 10, 2024, 3:11pm UTC](https://discuss.elastic.co/t/logstash-exec-ruby-script-in-docker/362895/1 "2024-07-10T15:11:18Z")

</div>

Hi, I'm trying to execute a ruby script which prints json data to stdout. I have tried different versions, and right now testing with the most basic script:

```auto
require 'json'

json_data = [
  { "uuid" => "noab14123dws11", "event_type" => "test", "created" => "2024-07-10T15:30:00Z" },
  { "uuid" => "3klhmls349s133", "event_type" => "test", "created" => "2024-07-10T14:35:00Z" }
]

json_string = json_data.to_json

puts json_string

```

In the logstash input i set:

```auto
exec {
    command => "unset JAVA_OPTS && /usr/share/logstash/bin/ruby /usr/share/logstash/ruby_event_script.rb"
    interval => 60
    codec => "json"
  }

```

I have tried in different ways with the provided jruby in docker. I had to unset the java opts variable because It was parsing a warning generated by ruby. Now when I run my pipeline I get in my logstash logs:  
Bundler::GemNotFound: Could not find rubocop-1.63.5, rubocop-1.63.5, rubocop-1.63.5, ..... with a bunch of other packages. Code does not work, events are not added.

How can I get this setup to work?
