Question

working with Kusto / KQL to try and parse the deadlock xml in Azure SQL Analytics and getting stuck with escaping the tag name process-list as follows

So the deadlock xml looks like

<deadlock>
  <process-list>
  ...

I want to get one of the attributes under process-list but KQL chokes on the hyphen and I don't know how to escape it to make it work - see the bold section in the last line

AzureDiagnostics | where (Category == "Deadlocks") | where ResourceId contains "/SERVERS/" | where ResourceId contains "/DATABASES/" | where Resource contains "Analytics" | project Resource = strcat(extract(".+/SERVERS/([^/]+)/.+", 1, ResourceId), ".", extract(".+/DATABASES/(.+)", 1, ResourceId)).tolower(), TimeGenerated, deadlock_xml_s | extend DeadlockXML = parse_xml(deadlock_xml_s) | extend KeyDeets = DeadlockXML.deadlock.process-list.waitresource

Was it helpful?

Solution

...but KQL chokes on the hyphen and I don't know how to escape it to make it work

Please see: https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/schema-entities/entity-names#identifier-quoting

for example: DeadlockXML.deadlock['process-list'].waitresource

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top