Dynamic userId in kusto query Application Insights

Wyllis Monteiro 41 Reputation points
2022-03-21T15:37:31.957+00:00

I'm new with Azure Application Insights service, I want to get data from my app (developed with Xamarin Forms, c#) and I need to make a specific query to be able to get a user stats and display it on my Azure Dashboard. I'm able to make this request for all users but not for one user. I show you my query

customEvents   
| where name == "LoggedUserEvent"  
| where timestamp > now() - 31d  
| extend Properties = todynamic(tostring(customDimensions.Properties))  
| extend userId = todouble(todecimal(Properties.UserId))  
| where userId == XXX  
| summarize Total = count() by bin(timestamp, 1d)  
| project Total, timestamp  

this query work's well and show me Total and timestamp as you can see

185248-capture-decran-2022-03-21-a-163414.png

but the issue it's I should specify

 | where userId == XXX  

Each time I want new data about specific user I have to update this line, is there en easier way to get this info using an input text for example or if you have any suggestions, salespeople will use this platform and need to be simple as possible. Thank you in advance

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.