Forum Discussion
mayanks
Apr 07, 2020Copper Contributor
query InsightMetrics with where clause on Tags
Hi I want to run a query to match an entry on tags which is a json like - TenantId SourceSystem TimeGenerated Computer Origin Namespace Name Val Tags AgentId Type _ResourceId Value...
CliveWatson
Apr 07, 2020Former Employee
The "/" is the issue as its a control character in KQL. This would be an example that works, you can alter
InsightsMetrics
| extend Tags = parse_json(Tags)
//| where Namespace == "prometheus"
| extend memorySizeMB_ = tostring(Tags.["vm.azm.ms/memorySizeMB"])
| where memorySizeMB_ == "mayank"
Go to Log Analytics and run query
or better still
InsightsMetrics
| extend Tags = parse_json(Tags)
//| where Namespace == "prometheus"
| where Tags.["vm.azm.ms/memorySizeMB"] > 5
mayanks
Apr 08, 2020Copper Contributor
Thanks Clive that worked for me 🙂