# Support for executing ruby script?

**URL:** <https://discuss.elastic.co/t/support-for-executing-ruby-script/26523>\
**Category:** Logstash\
**Created:** [July 29, 2015, 8:16pm UTC](https://discuss.elastic.co/t/support-for-executing-ruby-script/26523 "2015-07-29T20:16:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cheeseandpepper](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@cheeseandpepper](https://discuss.elastic.co/u/cheeseandpepper)\
**Post date:** [July 29, 2015, 8:16pm UTC](https://discuss.elastic.co/t/support-for-executing-ruby-script/26523/1 "2015-07-29T20:16:17Z")

</div>

Hi

I'm just getting started with Logstash and the ability to execute inline ruby is pretty neat. Is it possible to invoke a ruby script in a similar manner? The advantage would be that I could make it look better as a standalone script, I could test it independently, and it would be easier to maintain. Consider something like this:

```
filter {
  ruby {
    script_path => "/path/to/script.rb maybe with argv"
  }
}

```

Then...

```
#!/usr/bin/env ruby
class Script
  def initialize(argv)
    @something = argv[2]
  end

  def do_stuff
    @something.gsub(" ", ":")
  end
end
Script.new(ARGV).do_stuff

```

Is this currently possible and if not, I think it would make a great feature.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 29, 2015, 8:42pm UTC](https://discuss.elastic.co/t/support-for-executing-ruby-script/26523/2 "2015-07-29T20:42:21Z")

</div>

Why not just write a plugin? If that's too much work then it should be made easier.

Forking a process for each message doesn't scale. If we're going to have some kind of arbitrary filtering via an external process it needs to support persistent processes that can receive multiple messages.

---

<div class="post-metadata">

**Author:** ![cheeseandpepper](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@cheeseandpepper](https://discuss.elastic.co/u/cheeseandpepper)\
**Post date:** [July 29, 2015, 8:55pm UTC](https://discuss.elastic.co/t/support-for-executing-ruby-script/26523/3 "2015-07-29T20:55:30Z")

</div>

I see what you mean. Just looking at custom plugins, and this seems to be what I'm looking for!  
Thanks!

---

<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:** [July 6, 2017, 5:33am UTC](https://discuss.elastic.co/t/support-for-executing-ruby-script/26523/4 "2017-07-06T05:33:25Z")

</div>


