/usr/lib/ruby/vendor_ruby/lograge/formatters/logstash.rb is in ruby-lograge 0.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | module Lograge
module Formatters
class Logstash
def call(data)
load_dependencies
event = LogStash::Event.new(data)
event['message'] = "[#{data[:status]}] #{data[:method]} #{data[:path]} (#{data[:controller]}##{data[:action]})"
event.to_json
end
def load_dependencies
require 'logstash-event'
rescue LoadError
puts 'You need to install the logstash-event gem to use the logstash output.'
raise
end
end
end
end
|