Commit 2025f361 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'sh-lograge-strip-location-header' into 'master'

Strip any query string parameters from Location headers from lograge

See merge request gitlab-org/gitlab-ce!17895
parents 78878355 467aa65e
# Monkey patch lograge until https://github.com/roidrage/lograge/pull/241 is released
module Lograge
class RequestLogSubscriber < ActiveSupport::LogSubscriber
def strip_query_string(path)
index = path.index('?')
index ? path[0, index] : path
end
def extract_location
location = Thread.current[:lograge_location]
return {} unless location
Thread.current[:lograge_location] = nil
{ location: strip_query_string(location) }
end
end
end
# Only use Lograge for Rails # Only use Lograge for Rails
unless Sidekiq.server? unless Sidekiq.server?
filename = File.join(Rails.root, 'log', "#{Rails.env}_json.log") filename = File.join(Rails.root, 'log', "#{Rails.env}_json.log")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment