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

Log rate limited IPs #37

Closed
jakanaka opened this issue Jan 30, 2024 · 5 comments
Closed

Log rate limited IPs #37

jakanaka opened this issue Jan 30, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@jakanaka
Copy link

I want to log which IP's are rate limited with date and stuff. Is it already possible now?

@jakanaka jakanaka changed the title Log rate limed IPs Log rate limited IPs Feb 2, 2024
@mholt
Copy link
Owner

mholt commented Feb 2, 2024

Good q -- we don't currently emit logs when a rate limit has been reached.

What would you like to have, specifically?

cf.

func (h *Handler) rateLimitExceeded(w http.ResponseWriter, repl *caddy.Replacer, zoneName string, wait time.Duration) error {

@jakanaka
Copy link
Author

jakanaka commented Feb 3, 2024

Good q -- we don't currently emit logs when a rate limit has been reached.

What would you like to have, specifically?

cf.

func (h *Handler) rateLimitExceeded(w http.ResponseWriter, repl *caddy.Replacer, zoneName string, wait time.Duration) error {

for me, the time, and the client ip should be enough, it will be even better if it is possible give each ip some sort of reputation based on how frequently it gets rate limited and based on that block that ip for longer time or something, or maybe add how many times it got rate limited

@mholt mholt closed this as completed in 3d68475 Mar 6, 2024
@mholt
Copy link
Owner

mholt commented Mar 6, 2024

Added in 3d68475 -- let me know if that doesn't work for you!

@mholt mholt added the enhancement New feature or request label Mar 6, 2024
inahga pushed a commit to divviup/caddy-ratelimit that referenced this issue Mar 6, 2024
@francislavoie
Copy link

Does this only log the first time the limit is hit, or on every request after? Could be quite noisy and add pressure if they're hitting fast, no?

@mholt
Copy link
Owner

mholt commented Mar 6, 2024

Log sampling can be configured to tame eccentric logs. But yeah we don't keep any state as to whether it's a first hit or not.

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

No branches or pull requests

3 participants