Draft: use Drupal watchdog entity to check for failed logins in the future!
Thought there should be a better API than a direct SQL query... Read this spec for watchdog entity api... Wrote this code Then realised it's still draft spec... for an 8-year old issue...
But one day in the future when everyone's on Drupal 12 it might come in useful