Pages

Thursday, October 19, 2023

Generating unique IP visits rendered into a column chart with kusto query for Azure Storage Account hosted website published with an App Gateway

I recently worked with a client who needed to quickly host a static website requiring zero dynamic content and little to no updates for years. Given the short runway available and the team being cost conscious, we opted to use the Static website feature of an Azure Storage Account to publish the website. Other than having to deal with the [I think] widely known WebContentNotFound issue when reloading pages, the service provided an adequate way of hosting the website. There was already an App Gateway in the environment so it was used to provide custom domain and WAF protection capabilities.

A few weeks into the launch of the website, I was asked to generate some statistics for the websites visit and given that I had the Diagnostics settings for the App Gateway set up to send allLogs to a Log Analytics Workspace and the logs captured on the Storage Account wouldn’t provide the real public IP addresses of the inbound traffic, I decided to use KQL to obtain the report requested.

image

The following are two reports I generated and thought I’d share it in case anyone may be looking for this.

Review visits over a range of days with hours as scale
This report groups unique IP addresses into bins within an hour over the start and end date specified.

image

Review visits over a range of days
This report groups unique IP addresses for each day over the start and end date specified.

image

The queries can be retrieved from my GitHub repo: https://github.com/terenceluk/Azure/blob/main/Kusto%20KQL/Azure-App-Gateway-Website-Stats.kusto

Hope this helps anyone who needs this data. The query can easily be changed for any backend service hosting the website and modified for different results.

No comments: