Udaykumar Kr
Nggawe Nirman Tech Blog
3 min readMar 30, 2020

--

Capturing usage metrics from Auth0, leveraging AWS EventBridge

In our web portal, we use Auth0 for user authentication. Being a data driven organization, we wanted to create periodic reports around platform usage metrics such as,
- Number of users accessing the application
- Number of users experiencing issues during login or signup
- Number of users using mobile application vs our web platform
- Number of new users signing up in the system
- Number of users updating their password or changing their primary email address

Auth0 identifies multiple these occurrences and user actions via events. We needed to capture this data and bring into our data lake for sophisticated reporting.
AWS Event Bridge is a serverless event bus that acts as an intermediary allowing to send payloads from your applications (ex: SaaS applications) to AWS services. AWS Event Bridge routes events to a wide variety of other AWS targets like Lambda functions, SNS Topic, SQS Queue, ECS Task etc. We leveraged the AWS Event Bridge for publishing Auth-0 events into our data lake

In this solution design, Auth0 publishes all the events generated on the system to the Event Bridge. Event Bridge invokes a custom Lambda function which then processes all published events, filters them based on only the events required and further publishes downstream. Processed events data is published into an S3 bucket. An Athena table is then configured with S3 as the storage source which gets populated with the event data. We leverage the AWS Quick Sight dashboard for final reporting. The un-processed events are published to the lake as well for future purposes.

Below diagram depicts the solution design.

Below picture depicts some of the auth0 events captured, processed and used in the dashboard for the user reporting.

Steps to integrate auth0 with Event Bridge.

  1. Login to auth0 account.
  2. Select the auth0 tenant to configure with Event Bridge
  3. Go to Logs -> Streams
  4. Click on Create Stream Button
  5. Select Amazon Event Bridge
  6. Give a Name, your AWS account ID and select the AWS Region from the drop-down list.
  7. Click on Save button.
  8. You will see Event Source Name being generated automatically under “Event Source Name” and it will be of below format:

aws.partner/auth0.com/<auth0tenant>-5e5c0b82–4571–4b62-bc80–1024ea3facc5/auth0.logs

Now login to your AWS account.

Under Event Buses in Event Bridge Service, you should be able to see the same “Event Source Name” created in auth0 Under “Custom event bus” section. See the below image.

9 . Select the target from

10. Click on Rules on the left-hand side, create a Rule which watches every incoming event and Route it to different Target.

11. In our case, every event is Routed to the custom lambda function for further processing.

Business and IT benefits.

Leveraging these metrics,

  • Ops and support team can proactively contact users to resolve their login/sign up issues proactively rather than being approached by the user reactively.
  • Ops teams can identify issues in the production systems
  • Business teams will gain insights into the user metrics.

--

--