lib/logstasher/log_subscriber.rb in logstasher-0.6.5 vs lib/logstasher/log_subscriber.rb in logstasher-0.7.0
- old
+ new
@@ -13,12 +13,12 @@
data.merge! extract_exception(payload)
data.merge! extract_custom_fields(payload)
tags = ['request']
tags.push('exception') if payload[:exception]
- event = LogStash::Event.new(data.merge('source' => LogStasher.source, 'tags' => tags))
- LogStasher.logger << event.to_json + "\n"
+
+ LogStasher.logger << LogStasher.build_logstash_event(data, tags).to_json + "\n"
end
def redirect_to(event)
Thread.current[:logstasher_location] = event.payload[:location]
end
@@ -120,11 +120,10 @@
private
def process_event(event, tags)
data = LogStasher.request_context.merge(extract_metadata(event.payload))
- event = LogStash::Event.new(data.merge('source' => LogStasher.source, 'tags' => tags))
- logger << event.to_json + "\n"
+ logger << LogStasher.build_logstash_event(data, tags).to_json + "\n"
end
def extract_metadata(payload)
payload.slice(*MAILER_FIELDS)
end