Login Failure retry need blocked

Hi
have any way for add (a filter rule or script) that when an login failure from the same IP 3 times?
I see several trys of login in my log and i need denied all login failure with 3 consecutive times.

It is posible?

Gracias