Skip to content

Latest commit

 

History

History
95 lines (64 loc) · 4.07 KB

README.md

File metadata and controls

95 lines (64 loc) · 4.07 KB

Auth0 Log Stream Explorer Template

This is a template for an Auth0 Log Stream Explorer web application. It is built with Next.js and Tinybird.

This is a fork of the Logs Explorer Template with some modifications to make it work with Auth0 Log Streams.

Fork it and make it your own!

Quick Start

Deploy the Tinybird and Next.js to the cloud to get started quickly.

Deploy to Vercel

Configure Environment Variables and you are ready to go:

NEXT_PUBLIC_TINYBIRD_API_KEY=<YOUR_TINYBIRD_ADMIN_TOKEN>
NEXT_PUBLIC_TINYBIRD_API_URL=<YOUR_TINYBIRD_REGION_HOST>

Instrumenting your Auth0 Log Streams

Go to Auth0 Dashboard and configure your Log Streams

  • From the Auth0 dashboard, select Monitoring > Streams.
  • Select Create Stream.
  • Set this URL: <YOUR_TINYBIRD_REGION_HOST>/v0/events?name=logs&token=<YOUR_TINYBIRD_ADMIN_TOKEN>
  • Content Type is application/json and Content Format is JSON Lines.
  • Select the any event category to filter, like All, and a date in case you want to perform some backfilling. Then select Save.

You're done. Any of the Auth0 Log Streams events you selected is automatically sent to Tinybird through the Events API.

Local Development

Get started by forking the GitHub repository and then customizing it to your needs.

Start Tinybird locally:

curl -LsSf https://tbrd.co/fwd | sh
cd tinybird
tb local start
tb login
tb dev
token ls  # copy an admin token

Configure the Next.js application:

cd dashboard/log-analyzer
cp .env.example .env

Edit the .env file with your Tinybird API key and other configuration.

NEXT_PUBLIC_TINYBIRD_API_KEY=<YOUR_TINYBIRD_ADMIN_TOKEN>
NEXT_PUBLIC_TINYBIRD_API_URL=http://localhost:7181

Start the Next.js application:

cd dashboard/log-analyzer
npm install
npm run dev

Open the application in your browser:

http://localhost:3000

Read the dashboard/log-analyzer/README.md file for more information on how to use the application and tinybird/README.md for more information on how to customize the template.

Deployment

Deploy the Tinybird project to the cloud:

cd tinybird
tb --cloud deploy

Once deployed copy your Tinybird cloud host and read_pipes token, deploy the Next.js application to Vercel and configure the environment variables.