20259: Add documentation for banner and tooltip features
[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     payload = {
10       ClusterID: Rails.configuration.ClusterID,
11       request_id: event.payload[:request_id],
12     }
13     # Also log params (minus the pseudo-params added by Rails). But if
14     # params is huge, don't log the whole thing, just hope we get the
15     # most useful bits in truncate(json(params)).
16     exceptions = %w(controller action format id)
17     params = event.payload[:params].except(*exceptions)
18     params_s = Oj.dump(params)
19     if params_s.length > 1000
20       payload[:params_truncated] = params_s[0..1000] + "[...]"
21     else
22       payload[:params] = params
23     end
24     payload
25   end
26 end