Are there somewhere configuration options for logging?
I want to prevent discourse to log messages which are currently written by users. Is this somehow possible?
In a discussion titled âDiscourse logging optionsâ under the Support category, sbernhard asked whether itâs possible to prevent Discourse from logging user-submitted messages, specifically those appearing in production.log (e.g., POST requests with raw content). HAWK requested clarification, and sbernhard confirmed the desire to exclude such messages from logs entirely. HAWK followed up asking what exactly should be changed, and sbernhard reiterated the goal: to avoid seeing user messages in the logs. neounix provided a solution using Railsâ filter_parameters or filter_attributes to exclude sensitive or unwanted parameters like :raw from being logged, referencing Rails 6 documentation and external guides for further detail. This approach allows administrators to selectively suppress logging of specific request parameters without disabling logging entirely.
Are there somewhere configuration options for logging?
I want to prevent discourse to log messages which are currently written by users. Is this somehow possible?
Hi there, can you try to explain again? Itâs not clear what youâre asking for here, sorry!
Well, in discourse/rails/production.log every message is logged, like
Started POST "/posts" for 1.15.7.3 at 2020-11-12 13:46:27 +0000
Processing by PostsController#create as */*
Parameters: {"raw"=>"This is a message which shouldn't be logged in my eyes"
And what are you wanting to change?
I donât want to see these messages in the log, if possible.
To filter a specific parameter in Rails, you can do this (old method before âfilter_attributesâ, see below) via a plugin:
Rails.application.config.filter_parameters += [
:raw,
:signature,
:return_url,
:api_url,
:access_token_url,
:code
]
You can also use:
filter_attributes
See also filter_attributes and other good info on this here:
Hope this helps @sbernhard
See also: