Applications have notifications issued via e-mail as set-up in `environments/production.rb' :
Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[error] - ",
:sender_address => %{"notifier" [email protected]},
:exception_recipients => %w{[email protected]}
}
All the bad actors probing an appication are generating a 404 error (including google with 'A=0
string), which in turn generates notifications which are by and large noise pollution. (there is no point in blocking ips, we've just observed a chain of probes with the same string coming from 12 different ip addresses...)
A serendipitous side effect of having i18n enabled and the locale added to the URL means that all these errors are of the same type some_darned_string "is not a valid locale"
. Processing a 404 error is acceptable in terms of performance hit relative to leaving the bad actor in the dark.
The question however is, how can we conditionally filter ExceptionNotification::Rack to not send the mail when its contents has the string is not a valid locale
.
You can add custom exceptions to the ignore list
There are also some useful options like ignore_crawlers
or ignore_if
that'll allow you to filter exceptions based on their contents