Last active
May 28, 2019 22:51
-
-
Save yaauie/e93e97b54b333c6d5ada23bcee4c7f66 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
filter { | |
ruby { | |
path => "${PWD}/processor-hostname.logstash-filter-ruby.rb" | |
script_params => { | |
"target" => "@processed-by" | |
} | |
} | |
} |
This file contains hidden or 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
def register(params) | |
params = params.dup | |
@target = params.delete('target') || fail(LogStash::ConfigurationError.new('`target` parameter is required')) | |
@hostname = Socket.get_hostname.dup.freeze | |
end | |
def filter(event) | |
event.set(@target, @hostname) | |
ensure | |
return [event] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment