Module: LogstashRails::Formatter

Defined in:
lib/logstash_rails/formatter.rb

Class Method Summary collapse

Class Method Details

.format(event_type, start, finish, id, payload) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/logstash_rails/formatter.rb', line 7

def self.format(event_type, start, finish, id, payload)
  fields = {
    process_id: $$,
    host: Socket.gethostname
  }

  event = LogStash::Event.new(payload.merge!(fields))

  event.timestamp = start
  event.message   = event_type
  event.source    = application_name

  event.to_json
end