This blog is part of our Rails 5 series.
For security reasons, we do not want sensitive data like passwords, credit card information, auth keys etc to appear in log files.
it very easy to filter such data.
Just add following line in
application.rb to filter sensitive
Now the log file will show
instead of real password value.
This replacement of
is done recursively.
In all the above cases, “123” would be replaced by “[FILTERED]”.
Now think of a situation where we do not want to filter all the occurrence of a key. Here is an example.
We definitely want to filter
but we want
[:color][:code] to show up in the log file.
The application.rb changes from
In this case
so long as
Rails will filter the data.