Rails has built in log filtering so you don\'t log passwords and credit cards. Works great for that but when you want to trigger a custom log (like to email) and send your
Just to add on @tadman answer:
When using except, beware that it will remove only top-level keys of your parameters, eg:
params = {
search_query: 'foobar',
secret_key1: 'SENSITIVE_KEY_1',
auth_info: {secret_key_2: 'SENSITIVE_KEY2'}
}
params.except(:secret_key1, :secret_key2)
=> {:search_query=>"foobar", :auth_info=>{:secret_key_2=>"SENSITIVE_KEY2"}}
Using request.filtered_parameters will filter both of those keys if they are in config/application.rb
config.filter_parameters += [:password]