<?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 How do I edit my search using tstats to get top hosts by percentage? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194660#M56126</link>
    <description>&lt;P&gt;I run the following every morning, but I know it could be accomplished more efficiently using tstats, but I cannot get the top host by percentage of all host.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | top  20 host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following gives me the top host, but I also want to know the percentage of all the hosts.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count by host | sort -count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Jul 2015 11:35:57 GMT</pubDate>
    <dc:creator>mcbradford</dc:creator>
    <dc:date>2015-07-07T11:35:57Z</dc:date>
    <item>
      <title>How do I edit my search using tstats to get top hosts by percentage?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194660#M56126</link>
      <description>&lt;P&gt;I run the following every morning, but I know it could be accomplished more efficiently using tstats, but I cannot get the top host by percentage of all host.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | top  20 host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following gives me the top host, but I also want to know the percentage of all the hosts.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count by host | sort -count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2015 11:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194660#M56126</guid>
      <dc:creator>mcbradford</dc:creator>
      <dc:date>2015-07-07T11:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search using tstats to get top hosts by percentage?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194661#M56127</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count by host | eventstats sum(count) as total | eval percentage = count/total*100 | fields - total | sort - count | head 20
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2015 11:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194661#M56127</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-07T11:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search using tstats to get top hosts by percentage?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194662#M56128</link>
      <description>&lt;P&gt;I downvoted this post because doesn't work on large event sets over 10000 rows&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 18:08:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194662#M56128</guid>
      <dc:creator>w531t4</dc:creator>
      <dc:date>2016-11-28T18:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search using tstats to get top hosts by percentage?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194663#M56129</link>
      <description>&lt;P&gt;All you need to do is read the &lt;CODE&gt;sort&lt;/CODE&gt; docs: &lt;CODE&gt;| sort 0 - count&lt;/CODE&gt; will work for larger sets.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/sort"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/sort&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 18:19:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194663#M56129</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2016-11-28T18:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search using tstats to get top hosts by percentage?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194664#M56130</link>
      <description>&lt;P&gt;I suppose that works, my mistake. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 18:24:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-using-tstats-to-get-top-hosts-by/m-p/194664#M56130</guid>
      <dc:creator>w531t4</dc:creator>
      <dc:date>2016-11-28T18:24:22Z</dc:date>
    </item>
  </channel>
</rss>

