Skip to content

Commit

Permalink
Log rate limit hits (#7096)
Browse files Browse the repository at this point in the history
Fix #7095
  • Loading branch information
Gargron committed Apr 9, 2018
1 parent 0c52654 commit 80a944c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/initializers/rack_attack_logging.rb
@@ -0,0 +1,4 @@
ActiveSupport::Notifications.subscribe('rack.attack') do |_name, _start, _finish, _request_id, req|
next unless [:throttle, :blacklist].include? req.env['rack.attack.match_type']
Rails.logger.info("Rate limit hit (#{req.env['rack.attack.match_type']}): #{req.ip} #{req.request_method} #{req.fullpath}")
end

0 comments on commit 80a944c

Please sign in to comment.