Last active
August 10, 2017 21:31
-
-
Save FabienArcellier/0e766ff0b7ccbbe101dd to your computer and use it in GitHub Desktop.
Use ruby object in logstash ruby filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
stdin {} | |
} | |
filter { | |
ruby { | |
init => "load('ruby.rb'); @val=Myclasse.new('value')" | |
code => "event['method'][email protected]()" | |
} | |
} | |
output { | |
# Debug sur la sortie standart | |
stdout { codec => rubydebug } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Myclasse | |
attr_reader :value | |
attr_writer :value | |
def initialize(value) | |
@value = value | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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