diff --git a/lib/logstash/outputs/rabbitmq.rb b/lib/logstash/outputs/rabbitmq.rb index 36224ae..9162412 100644 --- a/lib/logstash/outputs/rabbitmq.rb +++ b/lib/logstash/outputs/rabbitmq.rb @@ -51,8 +51,8 @@ def register @thread_local_exchange = java.lang.ThreadLocal.new end - def symbolize(myhash) - Hash[myhash.map{|(k,v)| [k.to_sym,v]}] + def symbolize(myhash, event) + Hash[myhash.map{|(k,v)| [k.to_sym, if v.is_a? String then event.sprintf(v) else v end]}] end def multi_receive_encoded(events_and_data) @@ -63,7 +63,7 @@ def multi_receive_encoded(events_and_data) def publish(event, message) raise ArgumentError, "No exchange set in HareInfo!!!" unless @hare_info.exchange - local_exchange.publish(message, :routing_key => event.sprintf(@key), :properties => symbolize(@message_properties.merge(:persistent => @persistent))) + local_exchange.publish(message, :routing_key => event.sprintf(@key), :properties => symbolize(@message_properties.merge(:persistent => @persistent), event)) rescue MarchHare::Exception, IOError, AlreadyClosedException, TimeoutException => e @logger.error("Error while publishing. Will retry.", :message => e.message, @@ -97,4 +97,4 @@ def close end end end -end \ No newline at end of file +end