Azure
Forwarding logs from Azure log analytics and other managed azure services
Installation
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 https://logpatterns.packetai.co/deploy/agent
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("https://raw.githubusercontent.com/PacketAI/azure-logs-forwarder/main/logs-forwarder.ps1", "logs-forwarder.ps1")
./logs-forwarder.ps1 -SubscriptionId YOUR_SID -PAI_IID YOUR_PAI_IID -PAI_TOKEN YOUR_PAI_TOKEN -PacketAISite vector-ingester-logpatterns.packetai.co -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
andYOUR_PAI_TOKEN
needs to get them fromhttps://logpatterns.packetai.co/deploy/agent
Forward logs from App insights
App Insights
Goto App Insights page on Azure portal.
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FTifB3YmmwvRQQshnQOQ0%252FScreenshot%25202022-09-26%2520at%252011.46.55.png%3Falt%3Dmedia%26token%3D8c74ec8b-83bf-4714-9fb4-68bb0c1a638f&width=768&dpr=4&quality=100&sign=e62a8266&sv=2)
Click on one of the application and click on Diagnose settings and Click on Add diagnosis settings.
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FYahNkZsEouc9jBvYlRuC%252FScreenshot%25202022-09-26%2520at%252011.49.53.png%3Falt%3Dmedia%26token%3D9a6d4a9e-77ad-4dd8-97c6-6cb29afb5663&width=768&dpr=4&quality=100&sign=df93835&sv=2)
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
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FILp2JLHtPgbPSesN5aSn%252FScreenshot%25202022-09-26%2520at%252011.50.42.png%3Falt%3Dmedia%26token%3D9bd1225d-4b96-4f15-a03a-3fa915a6a029&width=768&dpr=4&quality=100&sign=18956128&sv=2)
Azure Log Analytics
To forward logs from Azure Log Analytics, go to Log analytics page in Azure portal.
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FCKgPhSmKsE6CTVJtM395%252FScreenshot%25202022-09-26%2520at%252013.09.46.png%3Falt%3Dmedia%26token%3D73506b61-7667-42d4-a28b-2ba94b6a6f57&width=768&dpr=4&quality=100&sign=a183dd10&sv=2)
Click on New export rule, to select the logs to forward to event hub.
Enter the Rule name (packetai-eventhub)
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252F7A6B5C6KuheQjc71Bjpu%252FScreenshot%25202022-09-26%2520at%252013.13.47.png%3Falt%3Dmedia%26token%3Da5888a57-c668-42eb-8aae-d14ea7268f6c&width=768&dpr=4&quality=100&sign=1e51bbd2&sv=2)
Select the list of log sources to export
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FHzyCZBb1IxEyGVZyYD9U%252FScreenshot%25202022-09-26%2520at%252013.14.06.png%3Falt%3Dmedia%26token%3Daaf7e70b-78e9-4ddd-9050-9567770ffd85&width=768&dpr=4&quality=100&sign=1deafb0&sv=2)
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FPh14aRbnAfhE0UW6RoJL%252FScreenshot%25202022-09-26%2520at%252013.15.09.png%3Falt%3Dmedia%26token%3D71778dc9-e21d-40b1-b0d0-c299dea13098&width=768&dpr=4&quality=100&sign=41979823&sv=2)
Select the destination: select the event hub namespace previously created and the even hub name as packetai-eventhub
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FiyCorgwGN0rGQwx1vrH2%252FScreenshot%25202022-09-26%2520at%252013.58.24.png%3Falt%3Dmedia%26token%3D0cb39c1b-0370-4f30-ba78-56f8e2e1fe98&width=768&dpr=4&quality=100&sign=1d8abae&sv=2)
Review and click on Create
![](https://packetai.gitbook.io/~gitbook/image?url=https%3A%2F%2F1004160589-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUh1bMx9Zb5YpSL8Jqw%252Fuploads%252FY6D9utNKq1SXLeDLtPO5%252FScreenshot%25202022-09-26%2520at%252013.58.41.png%3Falt%3Dmedia%26token%3Df9f80a48-532a-4b4b-b02e-6687e06b98f4&width=768&dpr=4&quality=100&sign=c2015175&sv=2)
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
Logs
Once setup is complete, you should see your first logs on https://logpatterns.packetai.co/logs !
Last updated
Was this helpful?