Skip to content

Commit

Permalink
fix 8# - report exceptions on error log level
Browse files Browse the repository at this point in the history
  • Loading branch information
nukemberg committed Mar 17, 2016
1 parent 43f3a65 commit 04bea14
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/logstash/outputs/riemann.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,30 @@ def map_fields(parent, fields)
this_level = Hash.new
fields.each do |key, contents|
next if key.start_with?("@")
field = parent.nil? ? key : "#{parent}.#{key}"
if contents.is_a?(Hash)
this_level.merge! map_fields(field, contents)
else
this_level[field.to_sym] = contents
field = parent.nil? ? key : "#{parent}.#{key}"
if contents.is_a?(Hash)
this_level.merge! map_fields(field, contents)
else
this_level[field.to_sym] = contents
end
end
return this_level
end

public
def receive(event)


r_event = build_riemann_formatted_event(event)

@logger.debug("Riemann event: ", :riemann_event => r_event)
send_to_riemann(r_event)
end # def receive

def build_riemann_formatted_event(event)
# Let's build us an event, shall we?
r_event = Hash.new

r_event[:description] = event["message"]

if @riemann_event
Expand Down Expand Up @@ -162,7 +162,7 @@ def send_to_riemann(riemann_formatted_event)
@logger.debug("Riemann client proto: #{proto_client.to_s}")
proto_client << riemann_formatted_event
rescue Exception => e
@logger.debug("Unhandled exception", :error => e)
@logger.error("Unhandled exception", :error => e)
end
end # def send_to_riemann

Expand Down

0 comments on commit 04bea14

Please sign in to comment.