# Filtering what's logged

**URL:** <https://www.ruby-forum.com/t/filtering-whats-logged/158495>\
**Category:** Rails\
**Created:** [January 23, 2009, 10:17pm UTC](https://www.ruby-forum.com/t/filtering-whats-logged/158495 "2009-01-23T22:17:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thabenksta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@thabenksta](https://www.ruby-forum.com/u/thabenksta)\
**Post date:** [January 23, 2009, 10:17pm UTC](https://www.ruby-forum.com/t/filtering-whats-logged/158495/1 "2009-01-23T22:17:58Z")

</div>

We are currently using “rescue\_action\_in\_public” in application.rb to  
catch exceptions and send us alert emails. However, we have recently  
begun getting thousands of invalid requests with weird and very long  
URLS. My guess is that it is Windows viruses that the user isn’t even  
aware of since they are mainly coming from Windows machines and lots of  
different IP addresses. Our problem is the at it’s clogging up our log  
files and I think these are innocent (but annoying) enough to ignore.

What’s the cleanest way to detect an invalid exception based on the URL  
and not have it logged?

Is “log\_error(exc)” the best way?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![thabenksta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@thabenksta](https://www.ruby-forum.com/u/thabenksta)\
**Post date:** [January 23, 2009, 11:06pm UTC](https://www.ruby-forum.com/t/filtering-whats-logged/158495/2 "2009-01-23T23:06:33Z")

</div>

> URL  
> and not have it logged?

Not a direct answer to your question, but you may consider switching  
your setup to use hoptoad and then if they haven’t already integrated  
my patch to ignore certain user agents, patch it do to so. Or just  
look at my patch and adjust it to fit your scenario.

[http://hoptoadapp.com/welcome](http://hoptoadapp.com/welcome)  
[http://pjkh.com/articles/2009/01/06/rails-exceptions-hoptoad-and-annoying-user-agents/](http://pjkh.com/articles/2009/01/06/rails-exceptions-hoptoad-and-annoying-user-agents/)

No affiliation, just like their service…

-philip

---

<div class="post-metadata">

**Author:** ![thabenksta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@thabenksta](https://www.ruby-forum.com/u/thabenksta)\
**Post date:** [January 23, 2009, 11:10pm UTC](https://www.ruby-forum.com/t/filtering-whats-logged/158495/3 "2009-01-23T23:10:13Z")

</div>

Thanks, Philip. You are second person to suggest hoptoadapp. I like  
what they are doing, however my main concern was the privacy of our  
data, particularly since we accept credit cards, etc. on our site (even  
thought we filter confidential data using “filter\_parameter\_logging” but  
you never know if some filtering was missed since our codebase has grown  
large over time.

Thanks again.

Philip H. wrote:

> > URL  
> > and not have it logged?
> 
> Not a direct answer to your question, but you may consider switching  
> your setup to use hoptoad and then if they haven’t already integrated  
> my patch to ignore certain user agents, patch it do to so. Or just  
> look at my patch and adjust it to fit your scenario.
> 
> [Airbrake](http://hoptoadapp.com/welcome)  
> [http://pjkh.com/articles/2009/01/06/rails-exceptions-hoptoad-and-annoying-user-agents/](http://pjkh.com/articles/2009/01/06/rails-exceptions-hoptoad-and-annoying-user-agents/)
> 
> No affiliation, just like their service…
> 
> -philip
