Forum Discussion
Loganalytics - Query not able to create a chart?
Hi, I am pretty new with Azure LogAnalytics.
I am running this Query and I get expected result.
// Not reporting VMs
// VMs that have not reported a heartbeat in the last 5 minutes.
// To create an alert for this query, click '+ New alert rule'
Heartbeat
| where TimeGenerated > ago(24h)
| summarize LastCall = max(TimeGenerated) by Computer
| where LastCall < ago(5m)
But when I select "Chart" I get the following error message:
Failed to create visualization The Stacked Column can't be created as you are missing a column of one of the following types: int, long, decimal or real
Do you know how to get this chart working, how to I fix this?
Many Thanks,
Mattias
3 Replies
- loadedlouie270Copper Contributor
Hi Mattias260, sorry for not helping you resolve the matter, but today i encounter the same problem running this query :
So i got results, however, when I switch to chart view, I got the same error as you:
Does anyone know what's going on?
I'm assuming that this is something related to the type of the fields/columns in log analytics, or the chart not looking to the correct values.
- loadedlouie270Copper ContributorDigging a bit further i look into the query and exported into powerbi.
When i have done this the fields are has "text" fields....
So im guessing this is the problem with log analytics, its looking into it, but it sees the field as a "text" colunm instead of the "decimal Number" type of row...
I'm assuming that is is somehow related to a issue that log analytics reported a few weeks about a "missing" colunm...
I hope someone at microsoft, look at it and fix it.- loadedlouie270Copper Contributor
And here is a quick fix,
Add the following line for each of your decimal values,
|extend cpu = todecimal(avg_cpu_percent_s)Explaining what it does:
(extend command, follow by the name of the new colunm, in this case "cpu", provide a equal "=", and the command, "todecimal(nameofthecolumn).
this will create a new column and convert the avg_cpu_percent_s, to a decimal value, allowing the chart in log analytics to process it since it sees it in the new column as a number.
Hope it helps, and microsoft solve this, i manage a few subscriptions, and i got the same error in all of them, so its a wide spread bug to my opinion, and there will be more people complaining over time.
Hope this helps.