Forwarding logs from Azure log analytics and other managed azure services


In-order to send the logs from Azure we need to use Azure EventHub. Please get the YOUR_PAI_IID and YOUR_PAI_TOKEN from
  • Installing using Azure Cloud Shell
  • Run the below command to download logs-forwarder.ps1 in the Azure cloud Shell (select Powershell)
    • (New-Object System.Net.WebClient).DownloadFile("", "logs-forwarder.ps1")
  • ./logs-forwarder.ps1 -SubscriptionId YOUR_SID -PAI_IID YOUR_PAI_IID -PAI_TOKEN YOUR_PAI_TOKEN -PacketAISite -ResourceGroupLocation westeurope
    • ResourceLocation(region) should be where your application logs are located on Azure
    • SubscriptionId enter the subscription id which will be used to deploy azure functions forward the data PacketAI.
    • YOUR_PAI_IID and YOUR_PAI_TOKEN needs to get them from

Forward logs from App insights

App Insights

Goto App Insights page on Azure portal.
Click on one of the application and click on Diagnose settings and Click on Add diagnosis settings.
Enter diagnosis setting name, and select the categories and click on the checkboxes. you can exclude the metrics. Afterwards select the Stream to an event hub, Select the subscription (the same as the one we used when installing packetai log forwarder), Select the hub namespace (should starts with packetai-ns-uid), and event hub name (packetai-eventhub). Afterwards, you can click on save button on top left.
PS: The event hub namespace and you application should be in the same region, otherwise event hub won't be visible

Azure Log Analytics

To forward logs from Azure Log Analytics, go to Log analytics page in Azure portal.
Click on New export rule, to select the logs to forward to event hub.
Enter the Rule name (packetai-eventhub)
Select the list of log sources to export
Select the destination: select the event hub namespace previously created and the even hub name as packetai-eventhub
Review and click on Create

Other Azure services

It's possible to forward the logs from other services of Azure, As long as the resource has a Diagnostic settings available it's possible to forward the logs to Event hub, and then sent to PacketAI backend server. The process is same as App Insights


Once setup is complete, you should see your first logs on !