1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 Server::Application.configure do
8 config.lograge.enabled = true
9 config.lograge.formatter = Lograge::Formatters::Logstash.new
10 config.lograge.custom_options = lambda do |event|
12 request_id: event.payload[:request_id],
13 client_ipaddr: event.payload[:client_ipaddr],
14 client_auth: event.payload[:client_auth],
16 exceptions = %w(controller action format id)
17 params = event.payload[:params].except(*exceptions)
19 # Omit secret_mounts field if supplied in create/update request
22 ['container', 'secret_mounts'],
23 ['container_request', 'secret_mounts'],
24 ].each do |resource, field|
25 if params[resource].is_a? Hash
26 params[resource] = params[resource].except(field)
30 # Redact new_user_token param in /arvados/v1/users/merge
31 # request. Log the auth UUID instead, if the token exists.
32 if params['new_user_token'].is_a? String
33 params['new_user_token_uuid'] =
34 ApiClientAuthorization.
35 where('api_token = ?', params['new_user_token']).
37 params['new_user_token'] = '[...]'
40 params_s = SafeJSON.dump(params)
41 if params_s.length > Rails.configuration.max_request_log_params_size
42 payload[:params_truncated] = params_s[0..Rails.configuration.max_request_log_params_size] + "[...]"
44 payload[:params] = params