Sha256: 7fdb8549f6d360f5dfd3366ce4e25f3f781f7391ef5159c18e01aa21717ec184

Contents?: true

Size: 506 Bytes

Versions: 2

Compression:

Stored size: 506 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
lograge-0.3.1 lib/lograge/formatters/logstash.rb
lograge-with-time-0.4.0 lib/lograge/formatters/logstash.rb