Merge branch '8784-dir-listings'
[arvados.git] / apps / workbench / config / initializers / lograge.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 ArvadosWorkbench::Application.configure do
6   config.lograge.enabled = true
7   config.lograge.formatter = Lograge::Formatters::Logstash.new
8   config.lograge.custom_options = lambda do |event|
9     exceptions = %w(controller action format id)
10     params = {current_request_id: Thread.current[:current_request_id]}.
11              merge(event.payload[:params].except(*exceptions))
12     params_s = Oj.dump(params)
13     Thread.current[:current_request_id] = nil # Clear for next request
14     if params_s.length > 1000
15       { params_truncated: params_s[0..1000] + "[...]" }
16     else
17       { params: params }
18     end
19   end
20 end