Greg Stevens
Greg Stevens

Reputation: 1

How can I monitor low/no usage of an Azure web app

Our development team is starting to transition our code from an on prem environment to the Azure cloud. We have two subscriptions in Azure, one for our development environment and one for production. Because of the cost structure of Azure I'm a little worried that our Dev environment will end up being a dumping ground of resources that are no longer used or being updated, costing us 100s if not 1000s a month for applications that are no longer needed. My plan is to have every application that gets created to have an alert attached that will alert me when an application has had no traffic for a month.

My initial thought was to set up an alert in Azure Monitor that would check every day for user actions and when we go 30 days with no user actions it would fire the alert. I'm able to come up with KQL to check the logs, and I think I can set it to check once a day, but I'm having trouble with the timeframe of 30 days. Does anyone have a suggestion on how to do this or another way this could be accomplished? Thanks in advance.

Upvotes: 0

Views: 33

Answers (1)

Greg Stevens
Greg Stevens

Reputation: 1

I think I may have the answer. My KQL that triggers the alert includes

AppPageViews
| where ClientType == 'Browser'
| where TimeGenerated between (now(-30d) .. now())
| summarize count_sum = sum(ItemCount)

When this returns a zero I know that the site is no longer needed.

Upvotes: 0

Related Questions