# How to detect invalid login in a rule

**URL:** <https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151>\
**Category:** Get Help\
**Tags:** rules, auth0\
**Created:** [February 19, 2020, 6:20pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151 "2020-02-19T18:20:55Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![pbr0ck3r](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pbr0ck3r/32/19271_2.png) [@pbr0ck3r](https://community.auth0.com/u/pbr0ck3r)\
**Post date:** [February 19, 2020, 6:20pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/1 "2020-02-19T18:20:55Z")

</div>

Is there a way inside a rule to detect if a login was unsuccessful? Or do rules only fire on successful logins? I am looking to send logs from auth0 to another service when a invalid login happens. Hoping I can just do this via a rule.

---

<div class="post-metadata">

**Author:** ![pbr0ck3r](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pbr0ck3r/32/19271_2.png) [@pbr0ck3r](https://community.auth0.com/u/pbr0ck3r)\
**Post date:** [February 19, 2020, 6:21pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/2 "2020-02-19T18:21:43Z")

</div>

Saw this other thread, but no solution was provided. [Detect invalid login attempts and lock user in a rule](http://community.auth0.com/t/detect-invalid-login-attempts-and-lock-user-in-a-rule/16287)

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [February 19, 2020, 6:26pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/3 "2020-02-19T18:26:22Z")

</div>

Hi @pbr0ck3r,

Welcome to the Auth0 Community!

One of the Auth0 engineering types may correct me but I believe rules only execute [after successful authentication](https://cdn.auth0.com/blog/auth0-raises-100m-to-fuel-the-growth/inside-the-auth0-engine-high-res.jpg).

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 19, 2020, 6:42pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/4 "2020-02-19T18:42:29Z")

</div>

Hi @pbr0ck3r,

@markd is correct, rules run after _successful_ logins.

You could use a log stream to monitor failed logins.

> **[Log Streams](https://auth0.com/docs/customize/log-streams)**
>
> Describes how to export your log events in near real-time using log streaming.

Let me know if this works for you,  
Dan

---

<div class="post-metadata">

**Author:** ![pbr0ck3r](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pbr0ck3r/32/19271_2.png) [@pbr0ck3r](https://community.auth0.com/u/pbr0ck3r)\
**Post date:** [February 19, 2020, 6:50pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/6 "2020-02-19T18:50:58Z")

</div>

Hey @markd @dan.woda ,

Thanks so much for the quick response. I will check out Log streams.

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [February 19, 2020, 7:28pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/7 "2020-02-19T19:28:18Z")

</div>

Hi @dan.woda: Will log streams replace the various logging extensions (the HTTP based ones at least)?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 19, 2020, 7:43pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/8 "2020-02-19T19:43:43Z")

</div>

@markd I think eventually. Log streams is essentially an improvement on log extensions. It was built to for better delivery time and volume. If you want to know more I can reach out to the relevant folks.

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [February 19, 2020, 7:52pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/9 "2020-02-19T19:52:00Z")

</div>

All good, thanks. I will ping my TAM if I need more details. Good to see functionality like getting rolled in to the core product!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 19, 2020, 7:52pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/10 "2020-02-19T19:52:55Z")

</div>

@markd Log streams is a huge one for me. It is a great improvement. Sounds good!

---

<div class="post-metadata">

**Author:** ![pbr0ck3r](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pbr0ck3r/32/19271_2.png) [@pbr0ck3r](https://community.auth0.com/u/pbr0ck3r)\
**Post date:** [February 19, 2020, 9:51pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/11 "2020-02-19T21:51:40Z")

</div>

Looking into the AWS Event Bridge stuff. My end goal is to get the logs into S3. Would be cool if I could just go straight to a bucket from Auth0.

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [February 19, 2020, 9:59pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/12 "2020-02-19T21:59:14Z")

</div>

This is a great idea for an API. Have the API offer an HTTP endpoint to point the log stream at and then write the individual logs as JSON files to a bucket. Could work with any of the object storage services out there.

---

<div class="post-metadata">

**Author:** ![revital.k](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/revital.k/32/14154_2.png) [@revital.k](https://community.auth0.com/u/revital.k)\
**Post date:** [February 20, 2020, 7:16pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/13 "2020-02-20T19:16:13Z")

</div>

Hi @dan.woda,  
We want to use log streams to post to sentry, but we only want to post our failures. Is there a way to filter the events sent from the stream?

Thanks,  
Revi

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 20, 2020, 7:57pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/14 "2020-02-20T19:57:52Z")

</div>

@revital.k,

Welcome to the Community!

Not that I know right now, you would need to handle that on your side. You should be able to look for log [event type](https://auth0.com/docs/logs/references/log-event-type-codes) ‘f’ and filter out the other noise.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 5, 2020, 11:58pm UTC](https://community.auth0.com/t/how-to-detect-invalid-login-in-a-rule/38151/15 "2020-03-05T23:58:00Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
