X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6c0bf267d795a3ca49c3258c9490714c9e18d333..85c625c40ad873d0efac33f8a63c1ee256185e36:/apps/workbench/config/initializers/lograge.rb diff --git a/apps/workbench/config/initializers/lograge.rb b/apps/workbench/config/initializers/lograge.rb index fa19667e36..795be7bfc3 100644 --- a/apps/workbench/config/initializers/lograge.rb +++ b/apps/workbench/config/initializers/lograge.rb @@ -1,16 +1,26 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + ArvadosWorkbench::Application.configure do config.lograge.enabled = true config.lograge.formatter = Lograge::Formatters::Logstash.new config.lograge.custom_options = lambda do |event| + payload = { + ClusterID: Rails.configuration.ClusterID, + request_id: event.payload[:request_id], + } + # Also log params (minus the pseudo-params added by Rails). But if + # params is huge, don't log the whole thing, just hope we get the + # most useful bits in truncate(json(params)). exceptions = %w(controller action format id) - params = {current_request_id: Thread.current[:current_request_id]}. - merge(event.payload[:params].except(*exceptions)) + params = event.payload[:params].except(*exceptions) params_s = Oj.dump(params) - Thread.current[:current_request_id] = nil # Clear for next request if params_s.length > 1000 - { params_truncated: params_s[0..1000] + "[...]" } + payload[:params_truncated] = params_s[0..1000] + "[...]" else - { params: params } + payload[:params] = params end + payload end end