星期几的 Azure Log Analytics 查询
Azure Log Analytics Query for Day of the week
我正在尝试在日志分析工作区中构建一个图表,以找出一周中哪一天的登录次数最多。
我有这个问题
SigninLogs
| where ResultType == 0
| summarize SuccessfulSigns=count() by bin(TimeGenerated,1d)
但我想做一个条形图,你可以看到在星期日、星期一等查询的 90 天内有多少登录。
您可以将 dayofweek
与 format_timespan 一起使用,例如
let Days = datatable(day_number:int, day:string)
[
1, "Monday",
2, "Tuesday",
3, "Wednesday",
4, "Thursday",
5, "Friday",
6, "Saturday",
7, "Sunday",
];
SigninLogs
| where ResultType == 0
| summarize SuccessfulSigns=count() by day_number=toint(format_timespan(dayofweek(bin(TimeGenerated,1d)), "d"))
| join Days on day_number
| project SuccessfulSigns, day
returns 日期为整数 1=星期一,2=星期二,3=星期三并将其映射到数据表 day_number。
day SuccessfulSigns
Wednesday 135
我正在尝试在日志分析工作区中构建一个图表,以找出一周中哪一天的登录次数最多。
我有这个问题
SigninLogs
| where ResultType == 0
| summarize SuccessfulSigns=count() by bin(TimeGenerated,1d)
但我想做一个条形图,你可以看到在星期日、星期一等查询的 90 天内有多少登录。
您可以将 dayofweek
与 format_timespan 一起使用,例如
let Days = datatable(day_number:int, day:string)
[
1, "Monday",
2, "Tuesday",
3, "Wednesday",
4, "Thursday",
5, "Friday",
6, "Saturday",
7, "Sunday",
];
SigninLogs
| where ResultType == 0
| summarize SuccessfulSigns=count() by day_number=toint(format_timespan(dayofweek(bin(TimeGenerated,1d)), "d"))
| join Days on day_number
| project SuccessfulSigns, day
returns 日期为整数 1=星期一,2=星期二,3=星期三并将其映射到数据表 day_number。
day SuccessfulSigns
Wednesday 135