gitlab-org--gitlab-foss/lib/gitlab/grape_logging/loggers/client_env_logger.rb
Stan Hu e632ae8084 Standardize remote_ip and path keys for auth.log and api_json.log
Current `auth.log` uses `fullpath` and `ip`, while `api_json.log` uses
`remote_ip` and `path` for the same fields. Let's standardize these
namings to make it easier for people working with the data.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66167
2019-08-20 18:12:28 +00:00

16 lines
498 B
Ruby

# frozen_string_literal: true
# This is a fork of
# https://github.com/aserafin/grape_logging/blob/master/lib/grape_logging/loggers/client_env.rb
# to use remote_ip instead of ip.
module Gitlab
module GrapeLogging
module Loggers
class ClientEnvLogger < ::GrapeLogging::Loggers::Base
def parameters(request, _)
{ remote_ip: request.env["HTTP_X_FORWARDED_FOR"] || request.env["REMOTE_ADDR"], ua: request.env["HTTP_USER_AGENT"] }
end
end
end
end
end