mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
better logging in amqp output if we have trouble converting an event to json
This commit is contained in:
parent
c5683fa9f9
commit
cbae31f46d
1 changed files with 6 additions and 1 deletions
|
@ -80,7 +80,12 @@ class LogStash::Outputs::Amqp < LogStash::Outputs::Base
|
|||
@logger.debug(["Sending event", { :destination => to_s, :event => event }])
|
||||
begin
|
||||
if @target
|
||||
@target.publish(event.to_json, :persistent => @persistent)
|
||||
begin
|
||||
@target.publish(event.to_json, :persistent => @persistent)
|
||||
rescue JSON::GeneratorError
|
||||
@logger.warn(["Trouble converting event to JSON", $!, event.to_hash])
|
||||
return
|
||||
end
|
||||
else
|
||||
@logger.warn("Tried to send message, but not connected to amqp yet.")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue