10671: Changed default assigments to be before validation. Also make sure started_at...
[arvados.git] / services / api / config / initializers / lograge.rb
index 50e2e23c9229bf314bcf6cef787494779c7b48c3..4b1aea9e70be4802d2dead544f8b07e0d41ccf3e 100644 (file)
@@ -1,4 +1,14 @@
 Server::Application.configure do
   config.lograge.enabled = true
   config.lograge.formatter = Lograge::Formatters::Logstash.new
+  config.lograge.custom_options = lambda do |event|
+    exceptions = %w(controller action format id)
+    params = event.payload[:params].except(*exceptions)
+    params_s = Oj.dump(params)
+    if params_s.length > Rails.configuration.max_request_log_params_size
+      { params_truncated: params_s[0..Rails.configuration.max_request_log_params_size] + "[...]" }
+    else
+      { params: params }
+    end
+  end
 end