9854: Added ArvadosModel::UnresolvableContainerError exception to return a 422 http...
[arvados.git] / services / api / config / initializers / lograge.rb
index 50e2e23c9229bf314bcf6cef787494779c7b48c3..e5bd2002fae3c07a0758263add95c5bfb7189613 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 > 1000
+      { params_truncated: params_s[0..1000] + "[...]" }
+    else
+      { params: params }
+    end
+  end
 end