<?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: How can I compare the count of two hosts? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293527#M88618</link>
    <description>&lt;P&gt;What is the relationship between host1 and host2?  Typically, no two hosts will have the same statistics for anything, so I'm not sure what "big difference" might mean in your context.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Aug 2017 14:10:47 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-08-17T14:10:47Z</dc:date>
    <item>
      <title>How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293525#M88616</link>
      <description>&lt;P&gt;How to compare the two host events ?&lt;/P&gt;

&lt;P&gt;index=test| stats count by host | stats  list(count) as count by host&lt;/P&gt;

&lt;P&gt;my result is : &lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3396i9A4F100A4E9C1277/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;How to identify if there is a large variation in count between host1 and host 2 ?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 12:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293525#M88616</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2017-08-17T12:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293526#M88617</link>
      <description>&lt;P&gt;Will there always be 2 hosts or there can be more? What is your expected output?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 13:53:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293526#M88617</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-08-17T13:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293527#M88618</link>
      <description>&lt;P&gt;What is the relationship between host1 and host2?  Typically, no two hosts will have the same statistics for anything, so I'm not sure what "big difference" might mean in your context.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 14:10:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293527#M88618</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-17T14:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293528#M88619</link>
      <description>&lt;P&gt;How to identify if there is a large variation in count between host1 and host 2 ?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 05:46:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293528#M88619</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2017-08-18T05:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293529#M88620</link>
      <description>&lt;P&gt;I'm not sure what you're definition of "large variation" is, but there is a command in splunk called &lt;STRONG&gt;delta&lt;/STRONG&gt; that should be able to help.&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Delta"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Delta&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also, I'm not sure why you're adding &lt;CODE&gt;|stats list(count) as count by host&lt;/CODE&gt;as it should produce the same results as the stats command before it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test| stats count by host|delta count as delta p=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you're looking to add the percent, you could use &lt;STRONG&gt;top&lt;/STRONG&gt; &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Top"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Top&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test|top host|delta count as delta p=1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2017 14:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293529#M88620</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-18T14:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293530#M88621</link>
      <description>&lt;P&gt;Hi  cmerriman,&lt;/P&gt;

&lt;P&gt;Thanks for your valuable query .but requirement is to find percentage of host.i have two servers one is host 1 and another one is host 2.both host have almost same transaction amount.&lt;BR /&gt;
for eg :&lt;BR /&gt;
host 1 : 5.1%&lt;BR /&gt;
host 2: 4.9%&lt;/P&gt;

&lt;P&gt;In case of host have huge difference between transaction amount&lt;BR /&gt;
for eg:&lt;/P&gt;

&lt;P&gt;host 1: 5.1&lt;BR /&gt;
host 2: 2.0&lt;/P&gt;

&lt;P&gt;i need to set an alert for this differnce&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 07:33:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293530#M88621</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2017-08-22T07:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293531#M88622</link>
      <description>&lt;P&gt;so would  &lt;CODE&gt;index=test|top host|delta percent as delta p=1&lt;/CODE&gt; work, and then create an alert based on the value of &lt;STRONG&gt;delta&lt;/STRONG&gt;? since you only have the two hosts, you could fill in the other line of delta with &lt;CODE&gt;|sort + percent|filldown delta&lt;/CODE&gt; at the end of the search.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 12:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293531#M88622</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-22T12:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293532#M88623</link>
      <description>&lt;P&gt;Here's some code if you want to see if all the hosts are balanced within 10% of each other. This would alert if the highest host was carrying 10% more of the total traffic than the lowest host.   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test
| stats count as hostcount by host 
| eventstats max(hostcount) as maxcount min(hostcount) as mincount sum(hostcount) as totalcount
| eval pctcount = round(100*hostcount/totalcount,2)
| eval maxdiff = round(100*(maxcount-mincount)/totalcount,2)
| where maxdiff&amp;gt;10.0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's some code if  you want to see if the two lowest hosts are balanced within 5% of each other. This compares the lowest to the second-lowest, alerting if one of them is carrying 5% more of the total load than the other.  The code would function even if there was only one host, but it would obviously never alert in that case.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test
| stats count as hostcount by host 
| eventstats max(hostcount) as maxcount min(hostcount) as mincount sum(hostcount) as totalcount
| eval pctcount = round(100*hostcount/totalcount,2)
| eventstats min(eval(if(hostcount=mincount,null(),hostcount))) as min2count
| eval diffcount = round(100*(min2count-mincount)/totalcount,2) 
| where maxdiff&amp;gt;5.0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Aug 2017 13:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293532#M88623</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-22T13:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare the count of two hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293533#M88624</link>
      <description>&lt;P&gt;Hi DalJeanis,&lt;BR /&gt;
 I have two servers .in both two servers splunk forwarder is installed and pointed to index=test.The both servers have same level or more or less of transaction .but in my case the one server have 35 % and another server having 34 % means not a problem  . In case of large difference between the percentage in two servers .then i need to set alert for the conditions&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 05:50:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-the-count-of-two-hosts/m-p/293533#M88624</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2017-08-28T05:50:43Z</dc:date>
    </item>
  </channel>
</rss>

