azureazure-web-app-serviceazure-log-analytics

Turning off Log Analytics for Azure Web App Deployment Slots


I have an Azure Web App with 4 deployment slots. Every time I added a deployment slot, my Log Analytics bill went up, and I figured that the size of AppMetrics that were collected grew proportionally to me increasing the number of slots.

I can't find a way how can I turn off ingestion from some of the deployment slots, as they are not important for me. An alternative way to workaround my issue could be, to delete some of the ingested AppMetrics, based on the deployment slot name.

Other advice is also welcome.

I tried decreasing the retention time, but there is nothing lower than 30 days, which is fine for my main deployment slot, but for the rest I can go as low as 1 day.

I also tried searching for Log Analytics settings on the deployment slots, but I didn't find options to manage.


Solution

  • So what could be done is to control each slot's Application Insight settings with environment variables (https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-config for Java apps).

    What I did is to add environment variable APPLICATIONINSIGHTS_METRIC_INTERVAL_SECONDS=<something_really_big_here> to dramatically decrease the frequency of reported metrics, hence the size of data ingested. A little bit hacky, but does the trick.