<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Measure by-host &amp;quot;imbalance&amp;quot; in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600761#M209110</link>
    <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as load by host
| eval cluster=mvindex(split(host,"-"),0)
| eventstats sum(load) as total by cluster
| stats range(load) as imbalance values(total) as total by cluster
| eval imbalance=round(100*imbalance/total,2)&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 06 Jun 2022 21:58:56 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-06-06T21:58:56Z</dc:date>
    <item>
      <title>How to measure by-host "imbalance"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600548#M209060</link>
      <description>&lt;P&gt;Gurus&lt;/P&gt;
&lt;P&gt;I have an infoblox query that simply measures total amount of queries over a certain period by host for a given infoblox cluster. They are usually pretty uneven (25%&amp;nbsp; : 75%)&lt;/P&gt;
&lt;P&gt;I can use that in a pie chart easily. However, I'm also interested in measuring the "imbalance factor" so that I can rank clusters by most/least imbalanced. I have no clue where to start since I'd need 2 values to do math with but "count" isn't even a field.&lt;/P&gt;
&lt;P&gt;Is this possible ?&lt;/P&gt;
&lt;P&gt;Thx&lt;/P&gt;
&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 03:33:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600548#M209060</guid>
      <dc:creator>stucky101</dc:creator>
      <dc:date>2022-06-06T03:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600554#M209063</link>
      <description>&lt;P&gt;What information do you have? Can you share some sample events (preferably in a code block &amp;lt;/&amp;gt;)?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jun 2022 06:50:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600554#M209063</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-04T06:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600577#M209065</link>
      <description>&lt;P&gt;Hi ITWhisperer&lt;/P&gt;&lt;P&gt;The query itself doesn't matter at all. Any stats count by host for anything. Here an example.&lt;/P&gt;&lt;P&gt;I have pairs of infoblox nodes in a global grid and I wanna see how many queries each node served over the last 1h per regional cluster.&lt;/P&gt;&lt;P&gt;{dns query} host="ibcluster01-*" | stats count by host&lt;/P&gt;&lt;P&gt;This spits out 2 values and displays them per host. For easy math say the 2 counters are 25 and 75. Quite imbalanced.&lt;/P&gt;&lt;P&gt;Now I run it against another cluster&lt;/P&gt;&lt;P&gt;{dns query} host="ibcluster02-*" | stats count by host&amp;nbsp;&lt;/P&gt;&lt;P&gt;This time the 2 values are 45 and 55, quite balanced.&lt;/P&gt;&lt;P&gt;I wanted to measure the imbalance factor for each cluster so I can rank them. I was thinking measuring the gab between the 2 would do the trick.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cluster 01: 75 - 50 = imbalance of 50&lt;/P&gt;&lt;P&gt;Cluster 02 : 55 - 45 = imbalance of 10 (winner)&lt;/P&gt;&lt;P&gt;I could assign that number to a var called "imbalance" and now I could do a cluster ranking by most or least imbalanced by doing a "top 5 imbalance". That's the theory &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I can't help feeling there is already something fancy in SPL but I cannot find anything. Even if I did the math myself, wouldn't I need the 2 counters as fields so I can do further evals on them ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this clarifies my question.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jun 2022 17:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600577#M209065</guid>
      <dc:creator>stucky101</dc:creator>
      <dc:date>2022-06-04T17:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600578#M209066</link>
      <description>&lt;P&gt;Assuming, as per your example, host names begin with the cluster name followed by a hyphen, you could do something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as load by host
| eval cluster=mvindex(split(host,"-"),0)
| stats range(load) as balance by cluster&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 04 Jun 2022 18:24:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600578#M209066</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-04T18:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600579#M209067</link>
      <description>&lt;P&gt;I'm not home right now so doing this from phone. The actual hostnames are a bit more complex but this might still work. The names usefollowing standard:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;site-ibsn-cxnx.domainname&lt;/P&gt;&lt;P&gt;F.e. A site called "sjca" has these 2 hosts:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sjca-ibsn-c01n01.domain.com&lt;/P&gt;&lt;P&gt;sjca-ibsn-c01n02.domain.com&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The at site "laxa"&lt;/P&gt;&lt;P&gt;laxa-ibsn-c01n01.domain.com&lt;/P&gt;&lt;P&gt;laxa-ibsn-c01n02.domain.com&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc...I'll take a look at your suggestion when I can. Thank you for your help so far !&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jun 2022 19:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600579#M209067</guid>
      <dc:creator>stucky101</dc:creator>
      <dc:date>2022-06-04T19:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600742#M209105</link>
      <description>&lt;P&gt;So I tried this and yes, the range calculates well. However, I realized that this produces a value that is specific to this cluster only. It cannot be compared to the ranges of other clusters as they have a completely different number of hits within the same timeframe.&amp;nbsp; F.e.&lt;/P&gt;&lt;P&gt;A cluster that is 9:1 has a range of 8 (very imbalanced) while a cluster that is 60:40 has a range of 20. This would make it look more imbalanced when the opposite is true. I tried to apply some simple math after but it appears "load" loses its value right after the range calculation for some reason.&lt;/P&gt;&lt;P&gt;stats range(load) as balance by cluster | eval result=(balance/load*100) | table cluster,result&lt;/P&gt;&lt;P&gt;This produces nothing for "result". Yet, when I replace "load" with an arbitrary number it produces a value&lt;/P&gt;&lt;P&gt;stats range(load) as balance by cluster | eval result=(balance/30*100) | table cluster,result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, I can see that "load" loses its value right after doing the range calc on it.&lt;/P&gt;&lt;P&gt;stats range(load) as balance by cluster | table cluster,load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I presume the stats range function does that but how do I get these ranges turned into percentages for cross cluster comparison ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 18:22:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600742#M209105</guid>
      <dc:creator>stucky101</dc:creator>
      <dc:date>2022-06-06T18:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600761#M209110</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as load by host
| eval cluster=mvindex(split(host,"-"),0)
| eventstats sum(load) as total by cluster
| stats range(load) as imbalance values(total) as total by cluster
| eval imbalance=round(100*imbalance/total,2)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Jun 2022 21:58:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600761#M209110</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-06T21:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600765#M209111</link>
      <description>&lt;P&gt;You da man ! This deserves an upvote ! Thank you very much ! You saved my day.&lt;/P&gt;&lt;P&gt;I do have a question. I had almost figured out something similar and it looked great with ONE major problem.&lt;/P&gt;&lt;P&gt;I had this:&lt;/P&gt;&lt;P&gt;| stats count as load by host | eval cluster=mvindex(split(host,"-"),0) | stats first(load) as load range(load) as range by cluster | eval result=round((range/load)*100) | table cluster,result&lt;/P&gt;&lt;P&gt;Worked properly on all but a single cluster. On there I got percentage values over 100 :(.&lt;/P&gt;&lt;P&gt;I know the problem with stats is that it only returns the values it has created. I saw a post about that where someone suggested the trick using "first" to preserve the load value. I tried that but it turns out it only works when the cluster is imbalanced one way (n01 has more load than n02). I have this one cluster where that is reversed and the stats produce a reverse percentage here. Would there have been a way to make my query work for both cases as well ? Just curious.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 23:45:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600765#M209111</guid>
      <dc:creator>stucky101</dc:creator>
      <dc:date>2022-06-06T23:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600772#M209113</link>
      <description>&lt;P&gt;Instead of first(load), you could have used max(load)&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 04:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600772#M209113</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-07T04:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600950#M209180</link>
      <description>&lt;P&gt;Hmmm so these 2 queries do not produce the same results. Similar enough to get fooled initially, but not the same. When I check the top 10 with this:&lt;/P&gt;&lt;P&gt;| stats count as load by host | eval cluster=mvindex(split(host,"-"),0) | stats max(load) as load range(load) as range by cluster | eval imbalance=round((range/load)*100) | table cluster,imbalance | sort imbalance desc | head 10&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P&gt;lon03 100&lt;BR /&gt;gga 98&lt;BR /&gt;sms 97&lt;BR /&gt;tyoa 93&lt;BR /&gt;au01 92&lt;BR /&gt;rb01 90&lt;BR /&gt;swldmz 89&lt;BR /&gt;par 86&lt;BR /&gt;bp01 85&lt;BR /&gt;sf01 84&lt;/P&gt;&lt;P&gt;When I use this query:&lt;/P&gt;&lt;P&gt;| stats count as load by host | eval cluster=mvindex(split(host,"-"),0) | eventstats sum(load) as total by cluster | stats range(load) as imbalance values(total) as total by cluster | eval imbalance=round(100*imbalance/total) | table cluster,imbalance | sort imbalance desc | head 10&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P&gt;lon03 100&lt;BR /&gt;gga 96&lt;BR /&gt;sms 94&lt;BR /&gt;tyoa 86&lt;BR /&gt;au01 85&lt;BR /&gt;rb01 82&lt;BR /&gt;swldmz 80&lt;BR /&gt;par 76&lt;BR /&gt;bp01 74&lt;BR /&gt;sf01 72&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some with a 10point difference.&lt;/P&gt;&lt;P&gt;The percentage math is the same and we're both rounding. I wonder if both these queries can be considered equal. If so, should they not produce the same (or near same) numbers over the same timespan ?&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 21:43:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600950#M209180</guid>
      <dc:creator>stucky101</dc:creator>
      <dc:date>2022-06-07T21:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Measure by-host "imbalance"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600977#M209186</link>
      <description>&lt;P&gt;They are not the same calculation - one calculates the imbalance based on the difference in load as a percentage of the maximum load, whereas the other calculates the imbalance based on the difference in load as a percentage of the total load. Both can be considered as measures of imbalance but are equal at only two points, complete balance and complete imbalance.&lt;/P&gt;&lt;P&gt;Have a look at this runanywhere example to see the difference between the two ways of calculating the imbalance.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=51
| fields - _time
| streamstats count as row
| eval loadA=row - 1
| eval loadB=100 - loadA
| eval range=abs(loadA - loadB)
| eval imbalanceA=round(100*range/max(loadA, loadB),2)
| eval imbalanceB=round(100*range/(loadA + loadB),2)
| table loadA loadB range imbalanceA imbalanceB&lt;/LI-CODE&gt;&lt;P&gt;So, it comes down to what is it you are trying to show as your measure of imbalance.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 06:20:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-measure-by-host-quot-imbalance-quot/m-p/600977#M209186</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-08T06:20:31Z</dc:date>
    </item>
  </channel>
</rss>

