Class: LogStasher::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/logstasher/log_subscriber.rb

Constant Summary collapse

INTERNAL_PARAMS =
::ActionController::LogSubscriber::INTERNAL_PARAMS

Instance Method Summary collapse

Instance Method Details

#process_action(event) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/logstasher/log_subscriber.rb', line 20

def process_action(event)
  payload = event.payload
  tags    = extract_tags(payload)
  fields  = extract_request(payload)

  fields.merge! extract_status(payload)
  fields.merge! runtimes(event)
  fields.merge! location
  fields.merge! extract_exception(payload)
  fields.merge! extract_parameters(payload)
  fields.merge! appended_fields

  event = LogStash::Event.new(fields.merge('tags' => tags))

  LogStasher.logger << event.to_json + "\n"
end

#redirect_to(event) ⇒ Object



37
38
39
# File 'lib/logstasher/log_subscriber.rb', line 37

def redirect_to(event)
  Thread.current[:logstasher_context][:location] = event.payload[:location]
end