Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier
Last active August 10, 2017 21:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabienArcellier/0e766ff0b7ccbbe101dd to your computer and use it in GitHub Desktop.
Save FabienArcellier/0e766ff0b7ccbbe101dd to your computer and use it in GitHub Desktop.
Use ruby object in logstash ruby filter
input {
stdin {}
}
filter {
ruby {
init => "load('ruby.rb'); @val=Myclasse.new('value')"
code => "event['method']=@val.value()"
}
}
output {
# Debug sur la sortie standart
stdout { codec => rubydebug }
}
class Myclasse
attr_reader :value
attr_writer :value
def initialize(value)
@value = value
end
end
/opt/logstash/bin/logstash -f logstash.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment