Home>
Don't know

I want to know how to mask the SQL displayed in production.log in Ruby on Rails.

By adding a hidden value to Rails.application.config.filter_parameters
The value set above during POST was successfully masked as [FILTERED].

Example:

Processing by Api :: V1 :: ReceiveController # create as JSON
  Parameters: {"id_client" =>"[FILTERED]", "project_name" =>"[FILTERED]", "registered" =>"[FILTERED]"
Abbreviated

It just appears in SQL queries.

Is there a way to deal with it?
I would appreciate your teaching.

  • Answer # 1

    I would like to changeconfig.log_levelso that the SQL query log itself does not appear in production.log.

    If you really want to output
    https://docs.ruby-lang.org/en/latest/class/Logger=3a=3aFormatter.html
    Referring to, you will need to create your own Formatter and delete it yourself.

Related articles