- Quickly identify application issues in real time using ngrok request events and Azure logs processing.
- Historically audit changes occurring in an account.
- Profile usage of your service using logs queries and real-time data analytics.
- Identify security issues using ngrok events.
Create a Log Analytics workspace
These steps were adapted from the Microsoft documentation for creating a Log Analytics workspace.
- In a browser, sign in to the Azure portal.
- In the search bar, type Log Analytics Workspaces.
- Click the Services entry (not the Marketplace entry).
- Click Create on the top bar of the Log Analytics Workspace page.
- Follow the wizard to create your Log Analytics Workspace, filling in the region, name, and resource group, then click Review + Create. These values can be anything you like and do not affect ngrok’s ability to send logs to your Azure account.
- Click Create at the bottom of the review step to provision the Log Analytics Workspace.
Create a data collection endpoint
These steps were adapted from the Microsoft documentation for creating a data collection endpoint.
- In the search bar, type Data Collection Endpoints.
- Click the Services entry.
- Click Create on the top bar of the Data Collection Endpoints page.
- Follow the wizard to create your Data Collection Endpoint, filling in the region, name, and resource group, then click Review + Create. These fields can be anything you like and do not affect ngrok’s ability to send logs to your Azure account.
- Click Create at the bottom of the review step to provision the Data Collection Endpoint.
Create a DCR-based custom table in the workspace
These steps were adapted from the Microsoft documentation for creating a new table in a Log Analytics workspace.
- Navigate to the Log Analytics Workspaces list again.
- Click the workspace you created in the Create a Log Analytics workspace step.
- In the sidebar of the selected workspace, go to Settings > Tables.
- Click Create on the top bar and click New custom log (DCR-based).
- Populate the table name with a name of your choice and the DCE field with the existing DCE you created in the Create a data collection endpoint step.
- Under the Data collection rule field, click Create a new data collection rule, which opens a drawer. Fill out the resource group and name, then click Done in the drawer.
- Click Next in the table creation wizard.
- Upload the following JSON file using the wizard. After uploading, you will see a warning header “TimeGenerated field is not found in the sample provided”; this is expected.
- Click the Transformation editor button on the top bar of the wizard to open a drawer.
- Paste in the following transformation and click Run.
- Click Apply, then Next, then Create.
Create a Microsoft Entra Application
These steps were adapted from the Microsoft documentation for creating a Microsoft Entra Application.
- In the search bar, type Microsoft Entra ID.
- Under Services, click Microsoft Entra ID (not the Marketplace item).
- In the sidebar, go to Manage > App registrations.
- Click New registration.
- Name the application ngrok-events or something similar to clarify its use; this entity is what ngrok uses to authenticate with your data collection endpoint.
- For account type, choose Accounts in this organizational directory only.
- Click Register.
Assign IAM permissions to the Application for the DCR
These steps were adapted from the Microsoft documentation for assigning permissions to the DCR.
- In the search bar, type Data collection rules.
- Under Services, click Data collection rules.
- Click the Data collection rule you created in the Create a DCR-based custom table in the workspace step.
- In the sidebar, click Access control (IAM).
- Click Add on the top bar.
- Click Add role assignment.
- Under Job function roles, search for Monitoring.
- Click Monitoring Metrics Publisher.
- Click Next to go to Members.
- Click Select members.
- Search for the app registration you created in the Create a Microsoft Entra Application step.
- Click the service principal and click Select.
- Click Review + assign, then Review + assign again to confirm the role assignment.
Gather necessary data for event destination
To create an event destination in the ngrok dashboard, gather the following from what you created in Azure:
- Tenant ID
- Application’s Client ID
- Application’s Client Secret
- DCR immutable ID
- DCR stream name
- DCE log ingestion URI
- To get the first three fields, go back to Microsoft Entra ID. In the top search bar, search for Entra and click Microsoft Entra ID.
- In the sidebar, go to Manage > App registrations and click the application you created in the Create a Microsoft Entra Application step.
- On the Overview page, copy Application (client) ID and Directory (tenant) ID.
- In the sidebar, go to Manage > Certificates & secrets.
- Click New client secret.
- Fill in the description and expiry date, then click Add.
- Copy the secret value provided by Azure. This value is only shown once; it will not be available after you navigate away.
- To get the DCR immutable ID and stream name, navigate to Data collection rules using the top search bar.
- Click the Data collection rule you created in the Create a DCR-based custom table in the workspace step.
- In the Overview tab, copy the Immutable Id value.
- In the sidebar, go to Configuration > Data sources.
-
Copy the Data source name, which starts with “Custom-” (for example,
Custom-NgrokEvents_CL). This is the DCR stream name. Use this value exactly as shown in Azure; passing a different format (such as the table name) results in a400 InvalidStreamerror from the Logs Ingestion API. - In the top search bar, navigate to Data collection endpoints.
- Click the Data collection endpoint you created in the Create a data collection endpoint step.
- In the Overview tab, copy the Logs Ingestion URI.
Create the new event destination in ngrok
At this point, you can create the event destination through the ngrok dashboard or via the ngrok API.Copy the returned event destination ID from the response.After you get a 200 response, your event destination is configured and subscribed to the set of event types you specified.
Creating through the ngrok dashboard
- Sign in to the ngrok dashboard and go to Log Exporting.
- Click + New Log Export.
- In the Sources tab, click Add Source to choose which events to send to Azure.
- In the Destinations tab, click Add Destination.
- Click Azure Logs Ingestion API.
- Fill in the fields using the values you collected in Step 6.
- Click Send Test Event and look for an example event in your Azure account. It may take a minute to appear due to propagation delays.
- Click Done and save the new Log Export.
Creating via the ngrok API
- Create an API key with ngrok (for example via the ngrok dashboard).
- Using your REST API tool of choice (cURL, Postman, and so on), run the following API calls.
- To create the Azure Logs Ingestion event destination, run:
- To create a log export (event subscription) using the event destination you created, run: