Guides / Monitoring

Detect API Abuse with Smart Actions

4 min readยทMonitoring

The Pattern

Credential stuffing and API abuse show up as clusters of auth failures in a short window โ€” 50 failed login attempts in 5 minutes from the same IP is a very different signal than 1 per hour.

Smart Actions detects the cluster automatically.

Step 1: Log Auth Failures

ts
// In your auth handler
export async function handleLogin(email: string, ip: string, success: boolean) {
  if (!success) {
    await logit.now("security", {
      event: "Auth failure",
      description: `Failed login for ${email}`,
      icon: "๐Ÿ”’",
      notify: false,
      tags: { ip, reason: "invalid_credentials" },
      metadata: { email, ip, userAgent: req.headers.get("user-agent") },
    });
  }
}

Step 2: Create the Abuse Detection Rule

FieldValue
NameAuth failure spike
Channelsecurity
Event nameAuth failure
Threshold20
Window5 minutes
Cooldown15 minutes
ActionPush notification
Push title๐Ÿ”’ Auth failure spike
Push body20+ failed logins in 5 minutes

Step 3: Add a Slack Alert for the Security Team

Create a second rule with the same trigger but a Webhook action pointing to your #security Slack channel:

FieldValue
NameAuth failure spike โ†’ Slack
Channelsecurity
Event nameAuth failure
Threshold20
Window5 minutes
Cooldown15 minutes
ActionWebhook
URLSlack incoming webhook URL

Response Playbook

When the alert fires:

  1. Check the Trigger History in Smart Actions to see the exact count
  2. Open the Events dashboard, filter by channel = "security", look at ip tags
  3. Block the IP at your WAF or rate limiter

Tips

  • Use a low threshold (20 in 5 min) for early warning. A legitimate user doesn't fail 20 logins in 5 minutes.
  • Log ip in tags (not just metadata) so you can group by IP in the LogIt dashboard without parsing JSON.
  • Add a separate rule for password reset abuse: event: "Password reset requested", threshold 10 in 10 min.

Try LogIt free

7-day trial. No credit card required.

Start free