Filter long log parameters in Rails
I ended up putting something like this in my application.rb
config.filter_parameters << lambda do |k, v|
if k == 'data' && v && v.class == String && v.length > 1024
v.replace('[FILTER]')
end
end
I couldn't find a better way to do this. So I look for the key 'data' in the params. And if the value for that data is a String and over a certain length, I just replace it so the logs isn't so cluttered.