Forum Discussion

aprhn's avatar
aprhn
Copper Contributor
Mar 11, 2020
Solved

Query to use percentage of values

Hello guys, I'm beginner in Azure and I started a project in Azure Log Analytics. I sent different values in a Custom Log from a Logic App (HTTP Request).   I have two values "cpu_used"...
  • CliveWatson's avatar
    Mar 11, 2020

    aprhn 

     

    You should be able to do the math with KQL.  This is fake but should give you the idea 

     

    https://ms.portal.azure.com#@72f988bf-86f1-41af-91ab-2d7cd011db47/blade/Microsoft_Azure_Monitoring_Logs/DemoLogsBlade/resourceId/%2FDemo/source/LogsBlade.AnalyticsShareLinkToQuery/q/H4sIAAAAAAAAA42OvQrCQBCE%252B4DvMASERALRB0hlZaMp1FbOuNFI7i7sXfAHH96sGtFCsJxhvplJU9BZ6aYmDIKcuBwEN5wOxITF9kiFnytNyDKEOduCnLMcQpkdMDPOK1PQO7BZWq%252FqUAoatsJialvjiR%252BRpFdrVbdPqZu20xDCtVorrq6E2a6mvGMz8aoy%252BqSSr0YZHT7yWFaaQsQJsHLEov7mBeh5bC%252B%252FbjXEBRmv9tIcdX7UL8VIJRe9jscxRpiMx3dHMfinWgEAAA%253D%253D/timespan/P1D

    // example
    Perf
    | where ObjectName == "Processor" and InstanceName == "_Total"
    | project CounterName , CounterValue , Computer
    | summarize IdlePct = sumif(CounterValue, CounterName == "% Idle Time" ), UserTime = sumif(CounterValue, CounterName == "% User Time" ) by Computer
    | summarize percentage = (sum(UserTime) / sum(IdlePct)) * 100
     
     

Resources