Skip to content

Instantly share code, notes, and snippets.

@yaauie
Last active May 28, 2019 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaauie/e93e97b54b333c6d5ada23bcee4c7f66 to your computer and use it in GitHub Desktop.
Save yaauie/e93e97b54b333c6d5ada23bcee4c7f66 to your computer and use it in GitHub Desktop.
filter {
ruby {
path => "${PWD}/processor-hostname.logstash-filter-ruby.rb"
script_params => {
"target" => "@processed-by"
}
}
}
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