about summary refs log tree commit diff
path: root/config/initializers/rack_attack_logging.rb
blob: ab4822e96b8bdfce6d2c6645f56d8c066bc61568 (plain) (blame)
1
2
3
4
5
6
7
ActiveSupport::Notifications.subscribe(/rack_attack/) do |_name, _start, _finish, _request_id, payload|
  req = payload[:request]

  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