I am trying to create a Chart on Azure App Insights for all the 500 ERROR we receive for Each Cloud_RoleName with unique type. What I wanted to do is show a trend week over week and also month over month on if we are getting new TYPES of 500 Error compared to previous week's data. Basically a week over week Trend analysis for 500 Errors. I have tried the following query:-
requests
| where resultCode =="500" and timestamp > ago(1d)
| join (exceptions) on operation_Id
| summarize by type, cloud_RoleName
This I understand will return only 1 previous days data summarized by type of 500 error. I am unfortunately not able to form the query to get the Trend data week over week of this. Any help on this KQL?
<> after Yoni's response I found a blog where a trend charts were generated for Security Events so I went ahead and used the query in blog and created it here.. but still nt sure I am getting what I want..maybe some1 can modify this query..as all I want is from Exception and REquest table a trend of new 500 Error Types week over week per cloud_roleName https://microsoftonlineguide.blogspot.com/2018/05/detect-malicious-activity-using-azure.html?showComment=1561507971564#c5650649192825890878
let T=requests
| where resultCode =="500" and timestamp > ago(30d)
| join (exceptions) on operation_Id
| summarize by type, cloud_RoleName, Date = startofday(timestamp);
T
| evaluate activity_counts_metrics(type,Date, startofday(ago(30d)), startofday(now()), 1d, type, cloud_RoleName)
| extend WeekDate = startofweek(Date)
| project WeekDate, Date, type, PotentialAnomalyCount = new_dcount, cloud_RoleName
| join kind= inner
(
T
| evaluate activity_engagement(type, Date, startofday(ago(30d)), startofday(now()),1d, 7d)
| extend WeekDate = startofweek(Date)
| project WeekDate, Date, Distribution1day = dcount_activities_inner, Distribution7days = dcount_activities_outer, Ratio = activity_ratio*100
)
on WeekDate, Date
| where PotentialAnomalyCount == 1 and Ratio < 100
| project WeekDate, Date, type, cloud_RoleName, PotentialAnomalyCount, Distribution1day, Distribution7days, Ratio
| render barchart kind=stacked