Forum Discussion
sarfrazkhs
Mar 30, 2020Copper Contributor
Log Analytics with IOTHUb
Hi Members,
I am in the process of fetching the distinct devices which are sending the data from log analytics but not quite getting the query to work as I know some syntax I am missing it.
AzureDiagnostics
|distinct (properties_s.deviceId)
| where ResourceType == "IOTHUBS"
| extend properties=parse_json(properties_s)
| extend deviceid=properties.deviceId
Thanks & Regards,
SSK
3 Replies
- CliveWatsonFormer EmployeeAzureDiagnostics| where ResourceType == "IOTHUBS"| distinct _ResourceIdReplace _ResourceId with a working column
- sarfrazkhsCopper Contributor
Thanks CliveWatson
I used the query as per the one but would like to know how can I get deviceId in the query.
AzureDiagnostics| where ResourceType == "IOTHUBS"| distinct properties_s- CliveWatsonFormer Employee
I don't have that data, but these are a near example:
AzureActivity | extend clientRequestId_ = tostring(parse_json(HTTPRequest).clientRequestId) | distinct clientRequestId_ AzureActivity | extend clientRequestId_ = tostring(parse_json(HTTPRequest).clientRequestId) | summarize count() by clientRequestId_Go to Log Analytics and run query
You can press the "..." to extend the data into a column