# Custom sensu extension logs settings every time an event is filtered

**URL:** https://discourse.sensu.io/t/custom-sensu-extension-logs-settings-every-time-an-event-is-filtered/1093
**Category:** Sensu Classic (EOL)
**Created:** [February 13, 2019, 12:49pm UTC](https://discourse.sensu.io/t/custom-sensu-extension-logs-settings-every-time-an-event-is-filtered/1093 "2019-02-13T12:49:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![t-sawyer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/t-sawyer/32/126_2.png) [@t-sawyer](https://discourse.sensu.io/u/t-sawyer)
#### Post date: [February 13, 2019, 12:49pm UTC](https://discourse.sensu.io/t/custom-sensu-extension-logs-settings-every-time-an-event-is-filtered/1093/1 "2019-02-13T12:49:52Z")

</div>

Here’s my simple extension:

> require ‘sensu/extension’
> 
> module Sensu  
> module Extension  
> class ServiceAlert \< Handler
> 
> ```
> def name
> "service-alert"
> end
> 
> def description
> "Extension/handler that relays alerts of services"
> end
> 
> def definition
> {
> :type => "extension",
> :name => name,
> :filters => ["filter_refresh"]
> }
> end
> 
> def run(event)
> message = Response.prepare(event)
> yield "#{message}", 0
> end
> end
> 
> class Response
> def self.prepare(event)
> {
> service: self.check_alias(event),
> status: self.action_status(event),
> output: self.check_output(event)
> }
> end
> ...
> end
> 
> ```
> 
> end  
> end

This works great and as advertised. The problem is that _every time_ an event is filtered, my sensu-server log outputs the _entire_ settings to the log file.

> {“timestamp”:“2019-02-13T13:31:07.260314+0100”,“level”:“info”,“message”:“event was filtered”, … ,“settings”: \<this objects, although a single line, actually spans about 100 lines.\>

It logs my entire settings _every time_ an even is filtered. This consists of rabbitmq config, _all_ of my checks, handlers, relays, filters, etc. This is annoying specially when filtering hundreds of events in a small space of time.

When the handler does need to fire, it works fine and just outputs what I want and some extra info:

> {“timestamp”:“2019-02-13T13:44:13.603596+0100”,“level”:“info”,“message”:“handler extension output”,“extension”:{“type”:“extension”,“name”:“service-alert”,“filters”:[“filter\_refresh”],“severities”:[“unknown”,“critical”,“warning”,“ok”]},“event”:{“id”:“977ec44d-f3ad-4129-b516-68fa82cd6858”},“output”:“…”,“status”:0}

Is there a way I can avoid logging settings everytime the event is filtered?

Note, this does not happen when using a plugin handler where the log line does not output settings and as a consequence the log output is reasonable.

Sensu: 0.29

---

<div class="post-metadata">

### Author: ![cwjohnston](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/cwjohnston/32/193_2.png) [@cwjohnston](https://discourse.sensu.io/u/cwjohnston)
#### Post date: [February 13, 2019, 7:56pm UTC](https://discourse.sensu.io/t/custom-sensu-extension-logs-settings-every-time-an-event-is-filtered/1093/2 "2019-02-13T19:56:12Z")

</div>

Hi @t-sawyer, thanks for raising this issue.

I believe the behavior you are experiencing is described in [sensu/sensu#1872](https://github.com/sensu/sensu/issues/1872), fixed in [sensu/sensu#1873](https://github.com/sensu/sensu/pull/1873) and released in Sensu 1.4.3. As such, I expect that upgrading to the latest version of Sensu should resolve the problem you’re experiencing.

Will you please let us know if you are able to replicate this behavior on the latest version Sensu?

---

<div class="post-metadata">

### Author: ![t-sawyer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/t-sawyer/32/126_2.png) [@t-sawyer](https://discourse.sensu.io/u/t-sawyer)
#### Post date: [February 14, 2019, 12:20pm UTC](https://discourse.sensu.io/t/custom-sensu-extension-logs-settings-every-time-an-event-is-filtered/1093/3 "2019-02-14T12:20:16Z")

</div>

> [@cwjohnston](#):
>
> Will you please let us know if you are able to replicate this behavior on the latest version Sensu?

Yes of course. Will do. And thanks for pointing me to the issue. I agree in that it looks like the same behavior.

---

<div class="post-metadata">

### Author: ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)
#### Post date: [March 1, 2019, 2:09pm UTC](https://discourse.sensu.io/t/custom-sensu-extension-logs-settings-every-time-an-event-is-filtered/1093/4 "2019-03-01T14:09:55Z")

</div>

Hi @t-sawyer,

Did upgrading help here?

---

<div class="post-metadata">

### Author: ![t-sawyer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/t-sawyer/32/126_2.png) [@t-sawyer](https://discourse.sensu.io/u/t-sawyer)
#### Post date: [April 16, 2019, 6:39am UTC](https://discourse.sensu.io/t/custom-sensu-extension-logs-settings-every-time-an-event-is-filtered/1093/5 "2019-04-16T06:39:51Z")

</div>

@cwjohnston @aaronsachs Yep. After upgrading to `1.7.0`, this was no longer a problem.
