Continuously export your Azure Application Insights logs to your Azure Blob Storage account. Application Insights have low retention for keeping your logs. Default is 90 days. Therefore, to keep your data for a longer duration, we can transfer it to the Azure Blob Storage account.
Prerequisites
- Active Azure Subscription
- Azure Web App with Azure Application Insights (with Workspace) enabled
- Azure Storage Account
Export Azure Application Insights Logs to Azure Blob Storage Account
Let me give you the background of my insights logs. I have an Azure Bot deployed sending Activity logs to Azure Application Insights. The same logs I want to store in the Azure Blob storage account.
I researched and found out that Continuous export is deprecated and even I am not sure how it worked earlier. Anyhow, what I am going to show you is the latest implementation as of today.
Let me show you a snapshot of my bot activity logs. The same logs should be available to me in the Azure blob storage.

To continuously export your application insights logs to Azure blob storage, go to your Application Insights resource. Click on Diagnostic settings
under Monitoring
.

Click on Add diagnostic setting
.

Give a name of your Diagnostic setting name. You can choose to export all logs and metrics or you can select from specific categories.

On the right-hand side of your categories, you can choose to export to the following destinations. But in this demo, we are focussing on archiving to a storage account.

Select your subscription and the storage account from the dropdown list. Click on Save
.

If you go back to the Diagnostic settings, you can find your newly created setting with the storage account linked.

Application Insights does not send individual log events, it groups the events (not sure for what period) and stores them into a JSON file which should be available in the blob storage.
To test your export, start using your application/bot to generate logs. After logs are generated, wait for 5-10 minutes till your logs are exported to the blob storage account.

My Activity logs are available in insights-logs-appevents
. Open it and navigate to the desired folder and find the JSON file. the files are placed deep inside the directories because it creates a separate directory wrt subscriptions, resource, year, month, date, etc.

Download the file and get all your logs.
You must be logged in to post a comment.