Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate limit logging should be more specific #775

Open
ezekg opened this issue Jan 19, 2024 · 0 comments
Open

Rate limit logging should be more specific #775

ezekg opened this issue Jan 19, 2024 · 0 comments

Comments

@ezekg
Copy link
Member

ezekg commented Jan 19, 2024

Right now, the logging is rudimentary. We should include all rate limiting information we have, especially the rate limit key.

ActiveSupport::Notifications.subscribe 'rack.attack' do |name, start, finish, request_id, data|
req = data[:request]
ip = req.env['action_dispatch.remote_ip'] || req.ip
fwd = req.env['HTTP_X_FORWARDED_FOR']
case req.env['rack.attack.match_type']
when :throttle
Keygen.logger.info "[rack.attack] Rate limited: request_id=#{request_id} ip=#{ip} fwd=#{fwd} via=rack_attack"
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant