Home

Azure log with percentiles with avg

%3CLINGO-SUB%20id%3D%22lingo-sub-210493%22%20slang%3D%22en-US%22%3EAzure%20log%20with%20percentiles%20with%20avg%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-210493%22%20slang%3D%22en-US%22%3E%3CP%3EI%20currently%20am%20using%20wire%20data%20and%20am%20able%20to%20do%20the%20following%3C%2FP%3E%0A%3CP%3E%3CEM%3EWireData%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%7C%20where%20ProcessName%20contains%20%22outlook%22%20and%20(%20RemoteIP%20matches%20regex%20%22%5E10%5C%5C..*%24%22)%20and%20TimeGenerated%20%26gt%3B%20ago(7d)%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3Eand%20Computer%20%3D%3D%20%22computername%22%20%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%7C%20summarize%20AverageKb%20%3D%20(avg(TotalBytes)%2F1024)%20by%20bin(TimeGenerated%2C%205m)%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%7C%20render%20timechart%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20gives%20me%20the%20avg%2C%20and%20another%20query%20is%20this%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWireData%3C%2FP%3E%0A%3CP%3E%7C%20where%20ProcessName%20contains%20%22outlook%22%20and%20(%20RemoteIP%20matches%20regex%20%22%5E10%5C%5C..*%24%22)%20and%20TimeGenerated%20%26gt%3B%20ago(7d)%20and%20Computer%20%3D%3D%20%22computername%22%3C%2FP%3E%0A%3CP%3E%7C%20summarize%20%5B%22KB%22%5D%20%3D%20percentile(TotalBytes%2F1024%2C95)%20by%20bin(TimeGenerated%2C%205m)%3C%2FP%3E%0A%3CP%3E%7C%20render%20timechart%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20I%20am%20trying%20to%20do%20is%20get%20the%20avg%20KB%20for%20the%2095%3CSUP%3Eth%3C%2FSUP%3E%20percentile%20of%20usage%20so%20I%20want%20to%20exclude%20the%20top%205%25%20highest%20values%20from%20the%20avg.%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ethanks%20in%20advance%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-210493%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-212667%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20log%20with%20percentiles%20with%20avg%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-212667%22%20slang%3D%22en-US%22%3E%3CP%3Ethx%20let%20me%20try%20that%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-212227%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20log%20with%20percentiles%20with%20avg%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-212227%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20trick%20to%20do%20this%20is%20to%20use%20avgif%20function%20that%20allow%20you%20to%20include%20in%20the%20average%20calculation%20only%20values%20in%20the%20right%20range.%20The%20crux%20is%20that%20you%20have%20to%20calculate%20the%20range%20beforehand.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20an%20example%20using%20the%20Perf%20table%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Elet%20CounterP95%3Dtoscalar(%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Perf%20%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%20where%20CounterName%20%3D%3D%20%22%25%20Free%20Space%22%20%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%20summarize%20percentile(%20CounterValue%2C%2095)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20)%3B%3CBR%20%2F%3EPerf%20%3CBR%20%2F%3E%7C%20where%20CounterName%20%3D%3D%20%22%25%20Free%20Space%22%20%3CBR%20%2F%3E%7C%20summarize%20avgif(CounterValue%2CCounterValue%3CCOUNTERP95%3E%0A%3C%2FCOUNTERP95%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHope%20it%20helps%2C%3C%2FP%3E%0A%3CP%3EMeir%20%3A%26gt%3B%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Sam Kim (SR PFE)
Microsoft

I currently am using wire data and am able to do the following

WireData

| where ProcessName contains "outlook" and ( RemoteIP matches regex "^10\\..*$") and TimeGenerated > ago(7d)

and Computer == "computername"

| summarize AverageKb = (avg(TotalBytes)/1024) by bin(TimeGenerated, 5m)

| render timechart

 

This gives me the avg, and another query is this

 

WireData

| where ProcessName contains "outlook" and ( RemoteIP matches regex "^10\\..*$") and TimeGenerated > ago(7d) and Computer == "computername"

| summarize ["KB"] = percentile(TotalBytes/1024,95) by bin(TimeGenerated, 5m)

| render timechart

 

 

What I am trying to do is get the avg KB for the 95th percentile of usage so I want to exclude the top 5% highest values from the avg. 

thanks in advance

2 Replies

Hi,

 

The trick to do this is to use avgif function that allow you to include in the average calculation only values in the right range. The crux is that you have to calculate the range beforehand.

 

Here is an example using the Perf table:

 

let CounterP95=toscalar(
    Perf
    | where CounterName == "% Free Space"
    | summarize percentile( CounterValue, 95)
    );
Perf
| where CounterName == "% Free Space"
| summarize avgif(CounterValue,CounterValue<CounterP95)

 

Hope it helps,

Meir :>

thx let me try that

Related Conversations
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
2 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies
*Updated 9/3* Syncing in Microsoft Edge Preview Channels
Elliot Kirk in Articles on
202 Replies