Support for executing ruby script?


(Cheeseandpepper) #1

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.


(Magnus B├Ąck) #2

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.


(Cheeseandpepper) #3

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


(system) #4