diff options
author | Brian Neel <brian@gitlab.com> | 2016-11-18 21:45:52 +0300 |
---|---|---|
committer | Brian Neel <brian@gitlab.com> | 2016-11-18 23:05:22 +0300 |
commit | e14bb160ac8756d663a1397de4482f02fd738e1e (patch) | |
tree | e3d1cbc259ee699d73475688961ae8fd38cd65bf /config | |
parent | 0e0f1dea089197fc3520ca3f520f6fff42417af3 (diff) |
Add logging for rack attack events
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/rack_attack_logging.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/config/initializers/rack_attack_logging.rb b/config/initializers/rack_attack_logging.rb new file mode 100644 index 00000000000..8bb9ea29c33 --- /dev/null +++ b/config/initializers/rack_attack_logging.rb @@ -0,0 +1,7 @@ +# Adds logging for all Rack Attack blocks and throttling events. + +ActiveSupport::Notifications.subscribe('rack.attack') do |name, start, finish, request_id, req| + if [:throttle, :blacklist].include? req.env['rack.attack.match_type'] + Rails.logger.info("Rack_Attack: #{req.env['rack.attack.match_type']} #{req.ip} #{req.request_method} #{req.fullpath}") + end +end |