mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
Simpler implementation of amqp routing keys
This commit is contained in:
parent
a14f1aff17
commit
a8b1b3ad20
1 changed files with 2 additions and 14 deletions
|
@ -34,7 +34,7 @@ class LogStash::Outputs::Amqp < LogStash::Outputs::Base
|
|||
config :name, :validate => :string, :required => true
|
||||
|
||||
# Key to route to
|
||||
config :key, :validate => :array
|
||||
config :key, :validate => :string
|
||||
|
||||
# The vhost to use
|
||||
config :vhost, :validate => :string, :default => "/"
|
||||
|
@ -90,19 +90,7 @@ class LogStash::Outputs::Amqp < LogStash::Outputs::Base
|
|||
|
||||
public
|
||||
def receive(event)
|
||||
if @key
|
||||
KEY_VARS[:type] = event.type
|
||||
#build routing key
|
||||
key = ''
|
||||
@key.each do |k|
|
||||
if k.match(/^:/)
|
||||
key = "#{key}.#{KEY_VARS[k[1..-1].to_sym]}"
|
||||
else
|
||||
key = "#{key}.#{k}"
|
||||
end
|
||||
end
|
||||
key = key[1..-1] #strip first .
|
||||
end
|
||||
key = event.sprintf(@key)
|
||||
@logger.debug(["Sending event", { :destination => to_s, :event => event, :key => key }])
|
||||
begin
|
||||
if @target
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue