我想根据customDimension.MyCustomProperty所有实体中存在的查询结果对数字进行排序.我怎样才能做到这一点?
我在Application Insights Analytics中有一些数据,它将动态对象作为自定义维度的属性.例如:
| timestamp | name | customDimensions | etc |
|-------------------------|---------|----------------------------------|-----|
| 2017-09-11T19:56:20.000 | Spinner | { | ... |
MyCustomDimension: "hi"
Properties:
context: "ABC"
userMessage: "Some other"
}
Run Code Online (Sandbox Code Playgroud)
那有意义吗?所以customDimensions中的键/值对.
我试图将该context属性调出为结果中的适当列.所以预期会是:
| timestamp | name | customDimensions | context| etc |
|-------------------------|---------|----------------------------------|--------|-----|
| 2017-09-11T19:56:20.000 | Spinner | { | ABC | ...
MyCustomDimension: "hi"
Properties:
context: "ABC"
userMessage: "Some other"
}
Run Code Online (Sandbox Code Playgroud)
我试过这个:
customEvents | where name == "Spinner" | extend Context = customDimensions.Properties["context"]
Run Code Online (Sandbox Code Playgroud)
还有这个:
customEvents | …Run Code Online (Sandbox Code Playgroud) 我想做,
https://example.com/dir01/?query=apple¶m=1https://example.com/dir01/?query=apple¶m=1https://example.com/dir01/?query=lemon+juice¶m=1https://example.com/dir01/?query=lemon+juice¶m=0https://example.com/dir01/?query=tasteful+grape+wine¶m=1applelemon+juicetasteful+grape+winehttps://aka.ms/AIAnalyticsDemo
我认为extract或parseurl(url)应该是有用的.我尝试了后者,parseurl(url)但不知道如何将"查询参数"提取为一列.
pageViews
| where timestamp > ago(1d)
| extend parsed_url=parseurl(url)
| summarize count() by tostring(parsed_url)
| render barchart
Run Code Online (Sandbox Code Playgroud)
url
http://aiconnect2.cloudapp.net/FabrikamProd/parsed_url
{"Scheme":"http","Host":"aiconnect2.cloudapp.net","Port":"","Path":"/FabrikamProd/","Username":"","Password":"","Query Parameters":{},"Fragment":""}我正在尝试在输出表中创建一行来计算总项目的百分比:
Something like this:
ITEM | COUNT | PERCENTAGE
item 1 | 4 | 80
item 2 | 1 | 20
Run Code Online (Sandbox Code Playgroud)
我可以很容易地获得一个包含ITEM和COUNT行的表,但我无法弄清楚如何获得总数(在这种情况下为5)作为数字,因此我可以计算列%的百分比.
someTable
| where name == "Some Name"
| summarize COUNT = count() by ITEM = tostring( customDimensions.["SomePar"])
| project ITEM, COUNT, PERCENTAGE = (C/?)*100
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢.
我的appInsights遥测中有一个自定义属性,它是键/值对的json数组。我想做的是投射出那个键/值对,看来一起使用parsejson和mvexpand就是实现这一点的方法。但是,我似乎缺少了一些东西。我表达式的最终结果是一个名为type的列,它是原始的json。尝试将任何属性添加到表达式将导致一个空列。
Json编码的属性
[{"type":"text/xml","count":1}]
Run Code Online (Sandbox Code Playgroud)
空气质量指数
requests
| project customDimensions
| extend type=parsejson(customDimensions.['Media Types'])
| mvexpand bagexpansion=array type
Run Code Online (Sandbox Code Playgroud)
更新6/30/17
如下图所示,要回答EranG的问题,请在将属性投影为列时输出我的请求。
project当我的数据通过 Azure App Insights 记录在 Azure 中时,unix 时间戳如何?我知道我可以用来now()获取当前时间戳,但是行的时间戳又如何呢?
是否有更短的方法来检查属性user_id是否不在给定列表中:
customEvents
| where user_Id != 123
and user_Id != 234
and user_Id != 345
Run Code Online (Sandbox Code Playgroud) 如何联合表然后应用where过滤器?基本上我想找到所有项目operation_Id == X
我有一个Application Insights Azure Stream Analytics查询,看起来像这样......
requests
| summarize count() by bin(duration, 1000)
| order by duration asc nulls last
Run Code Online (Sandbox Code Playgroud)
...这给了我这样的东西,它显示了在应用程序洞察中记录的按持续时间(以秒为单位)分组的请求数.
| 0 | 1000 |
| 1000 | 500 |
| 2000 | 200 |
Run Code Online (Sandbox Code Playgroud)
我希望能够添加另一列,显示每个bin中所有请求的异常计数.
我知道这extend用于添加额外的列,但为了这样做,我将不得不引用'外部'表达式来获取bin约束,我不知道该怎么做.这是最好的方法吗?或者我最好join一起尝试两张桌子然后再做summarize?
谢谢
我有一个应用程序洞察查询。在这个查询中,我想将几列加入/组合成一列,以显示如何实现这一点。
我想结合ip,城市,州,国家。
customEvents
| where timestamp >= ago(7d)
| where (itemType == 'customEvent')
| where name == "Signin"
| project timestamp, customDimensions.appusername, client_IP,client_City,client_StateOrProvince, client_CountryOrRegion
| order by timestamp desc
Run Code Online (Sandbox Code Playgroud) 遵循本指南,我将了解如何过滤自定义维度,但如何在存在“.”时进行过滤。在键/属性名称中?
例如,我想ServiceFabric.ServiceTypeName从这个自定义维度值中过滤:
{
"AspNetCoreEnvironment": "Production",
"ServiceFabric.ApplicationTypeName": "MyCompany.MyAppType",
"ServiceFabric.ServiceTypeName": "MyService",
"ServiceFabric.ApplicationName": "fabric:/MyCompany.MyApp",
"ServiceFabric.PartitionId": "some-guid",
"ServiceFabric.ServiceName": "fabric:/MyCompany.MyApp/MyService",
"ServiceFabric.InstanceId": "55555",
"ServiceFabric.NodeName": "my-node",
"CategoryName": "Microsoft.AspNetCore.Hosting.Internal.WebHost",
"Protocol": "HTTP/1.1",
"Host": "MyCompany.com",
"Method": "GET",
"Scheme": "https",
"Path": "/api/values"
}
Run Code Online (Sandbox Code Playgroud)
以下不起作用...
traces
| extend type = customDimensions.ServiceFabric.ApplicationTypeName
| where type == "MyCompany.MyAppType"
| order by timestamp desc
Run Code Online (Sandbox Code Playgroud) 我正在使用Application Insights的这个参考文档.
如何使用其他查询的输出进行子选择?
//Query 1
Events
| where Timestamp >= ago(30min) and Data contains('SomeString')
| project TraceToken
//I would like to use the first query's output in the subselect here.
Events
| where TraceToken in ({I would like to use the First query's output here.})
Run Code Online (Sandbox Code Playgroud)
在这种情况下,联接是否更好.哪个会有更好的表现.
我有一个非常简单的问题,但我正在使用appInsights并且似乎无法弄清楚如何在aiql或任何函数中复制row_number()函数(没有分区感).
我有网页浏览表,我按会话和时间戳排序.我想在集合中添加一个rown_number列
pageViews | where timestamp > ago(14d) | order by session_id, timestamp desc
| extend rn =row_number() partition by session_id
Run Code Online (Sandbox Code Playgroud)
有没有人知道这是否可能在aiql中