Hi @Ashwin Venkatesha ,
When I run your query it indeed returns null. (BTW I replaced the traces table to a datatable so that I could run the test)
datatable (operation_Name:string, message :string )
["QueueTriggerFuncApp","[QueueTrigger] Event Stats {'total_events': 8388, 'file_count': 2, 'aggregated_file_size': 573292}"]
| where operation_Name has "QueueTriggerFuncApp" and message has 'Event stats'
| extend json_string = parse_json(extract("\\{[^{}]*\\}", 0, message))
| mv-expand json_string
| project json_string.total_events
But if I replace the single quote with double quotes, it worked:
datatable (operation_Name:string, message :string )
["QueueTriggerFuncApp","[QueueTrigger] Event Stats {\"total_events\": 8388, \"file_count\": 2, \"aggregated_file_size\": 573292}"]
| where operation_Name has "QueueTriggerFuncApp" and message has 'Event stats'
| extend json_string = parse_json(extract("\\{[^{}]*\\}", 0, message))
| mv-expand json_string
| project json_string.total_events
Result:
So like @Bhargava-MSFT mentioned, the input should be a properly formatted JSON string.
But I see you have already improved the logging and that's also a solution.
Kind Regards,
Wilko
Please do not forget to "Accept the answer” wherever the information provided helps you, this can be beneficial to other community members. If you have extra questions about this answer, please click "Comment".