This file is indexed.

/usr/lib/ruby/vendor_ruby/lograge/formatters/graylog2.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
21
22
23
24
25
26
27
28
29
30
module Lograge
  module Formatters
    class Graylog2
      def call(data)
        # Cloning because we don't want to mess with the original when mutating keys.
        data_clone = data.clone

        base = {
          short_message: short_message(data_clone)
        }

        # Add underscore to every key to follow GELF additional field syntax.
        data_clone.keys.each do |key|
          data_clone[underscore_prefix(key)] = data_clone[key]
          data_clone.delete(key)
        end

        data_clone.merge(base)
      end

      def underscore_prefix(key)
        "_#{key}".to_sym
      end

      def short_message(data)
        "[#{data[:status]}] #{data[:method]} #{data[:path]} (#{data[:controller]}##{data[:action]})"
      end
    end
  end
end