Lately, I’ve been playing around a bit with Serverless Architecture using Azure. This weekend, I thought it’d be great to play around with Azure Function a little bit. It turns out when you create an Azure Function resource, it automatically collects log data in Application Insights (AppInsights). Check out getting started Azure Function.
This means that we can use KQL and create custom queries to analyze the log data using Kqlmagic in Jupyter Notebooks in Azure Data Studio. See an example of Kqlmagic notebook connecting to AppInsights on my GitHub. The notebook analyzes response times, performance, request trend and geo source of the requests.
If you’re new to connecting to AppInsights, here’s a tip on constructing the connection string when using Kqlmagic.
%kql appinsights://code;appid='aefefbbc-99b7-88ce-0023-2339238abc392b8';alias='myServerlessAppLog' -try-azcli-login-by-profile -!se
- The
appid
value can be obtained from Azure Portal.- Go to the AppInsights resource
- Choose API Access from the left menu (circled 1 as shown in the figure below).
- Then you’ll see Application ID, copy this for the appid value needed in the connection string above.
- The
alias
is optional. - Use
-try-azcli-login-by-profile
for SSO auth. - Use
-!se
to debug.
That’s it! Have fun with using Kqlmagic in Azure Data Studio notebooks to create useful and sophisticated troubleshooting guides for your serverless apps 🙂
No responses yet