Welcome to mirror list, hosted at ThFree Co, Russian Federation.

lograge.rb « initializers « config - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6ba2fa39aa6fd8fd4493bd0f6652aa12a335e6ba (plain)
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
# Only use Lograge for Rails
unless Gitlab::Runtime.sidekiq?
  filename = File.join(Rails.root, 'log', "#{Rails.env}_json.log")

  Rails.application.configure do
    config.lograge.enabled = true
    # Store the lograge JSON files in a separate file
    config.lograge.keep_original_rails_log = true
    # Don't use the Logstash formatter since this requires logstash-event, an
    # unmaintained gem that monkey patches `Time`
    config.lograge.formatter = Lograge::Formatters::Json.new
    config.lograge.logger = ActiveSupport::Logger.new(filename)
    config.lograge.before_format = lambda do |data, payload|
      data.delete(:error)
      data
    end

    # This isn't a user-reachable controller; we use it to check for a
    # valid CSRF token in the API
    config.lograge.ignore_actions = ['Gitlab::RequestForgeryProtection::Controller#index']

    # Add request parameters to log output
    config.lograge.custom_options = Gitlab::Lograge::CustomOptions
  end
end