# Discourse logging options

**URL:** https://meta.discourse.org/t/discourse-logging-options/177073
**Category:** Support
**Created:** [January 23, 2021, 9:22pm UTC](https://meta.discourse.org/t/discourse-logging-options/177073 "2021-01-23T21:22:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![sbernhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sbernhard/32/208186_2.png) [@sbernhard](https://meta.discourse.org/u/sbernhard)
#### Post date: [January 23, 2021, 9:22pm UTC](https://meta.discourse.org/t/discourse-logging-options/177073/1 "2021-01-23T21:22:23Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)
#### Post date: [January 25, 2021, 2:52am UTC](https://meta.discourse.org/t/discourse-logging-options/177073/2 "2021-01-25T02:52:28Z")

</div>

> [@sbernhard](#):
>
> 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!

---

<div class="post-metadata">

### Author: ![sbernhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sbernhard/32/208186_2.png) [@sbernhard](https://meta.discourse.org/u/sbernhard)
#### Post date: [January 25, 2021, 7:30pm UTC](https://meta.discourse.org/t/discourse-logging-options/177073/3 "2021-01-25T19:30:50Z")

</div>

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"

```

---

<div class="post-metadata">

### Author: ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)
#### Post date: [January 25, 2021, 10:33pm UTC](https://meta.discourse.org/t/discourse-logging-options/177073/4 "2021-01-25T22:33:11Z")

</div>

And what are you wanting to change?

---

<div class="post-metadata">

### Author: ![sbernhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sbernhard/32/208186_2.png) [@sbernhard](https://meta.discourse.org/u/sbernhard)
#### Post date: [January 26, 2021, 8:44am UTC](https://meta.discourse.org/t/discourse-logging-options/177073/5 "2021-01-26T08:44:07Z")

</div>

I don’t want to see these messages in the log, if possible.

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [January 26, 2021, 9:49am UTC](https://meta.discourse.org/t/discourse-logging-options/177073/6 "2021-01-26T09:49:21Z")

</div>

To filter a specific parameter in Rails, you can do this (old method before “filter\_attributes”, see below) via a plugin:

```ruby
Rails.application.config.filter_parameters += [
  :raw,
  :signature,
  :return_url,
  :api_url,
  :access_token_url,
  :code
]

```

You can also use:

```plaintext
 filter_attributes

```

See also `filter_attributes` and other good info on this here:

> **[rails 6: Prevents logging sensitive info accidentally](https://dev.to/shivashankarror/rails-6-prevents-logging-sensitive-info-accidentally-8c5)**
>
> Introduction In Rails generally we filter out sensitive params getting logged in the logs....

Hope this helps @sbernhard

See also:

> **[Rails 6 adds ActiveSupport::ParameterFilter](https://blog.saeloun.com/2019/12/03/rails-6-adds-activesupport-parameter-filter)**
>
> Rails 6 has moved ParameterFilter from ActionDispatch to ActiveSupport in order to support filtered attributes with ActiveRecord::Relation#inspect.
