<?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 Using Stats Command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180680#M52056</link>
    <description>&lt;P&gt;this search works great to provide me a list of hosts showing how much license usage over a 1 day period, but when I put it in a bar graph it does not work well because the stats command provides an OVERALL total as well as a total for each host, how to I remove the overall total and only show the total for the top 5 hosts.&lt;/P&gt;

&lt;P&gt;index="_internal" source="*license_usage.log" &lt;BR /&gt;
| rename h as host b as bytes&lt;BR /&gt;
| eval my_splunk_server = splunk_server &lt;BR /&gt;
| fields source mysourcetype host bytes pool originator my_splunk_server &lt;BR /&gt;
| eval mbytes=((bytes/1024)/1024) &lt;BR /&gt;
| stats sum(mbytes) as mbytes by host &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:29:50 GMT</pubDate>
    <dc:creator>rdelmark</dc:creator>
    <dc:date>2020-09-28T15:29:50Z</dc:date>
    <item>
      <title>Using Stats Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180680#M52056</link>
      <description>&lt;P&gt;this search works great to provide me a list of hosts showing how much license usage over a 1 day period, but when I put it in a bar graph it does not work well because the stats command provides an OVERALL total as well as a total for each host, how to I remove the overall total and only show the total for the top 5 hosts.&lt;/P&gt;

&lt;P&gt;index="_internal" source="*license_usage.log" &lt;BR /&gt;
| rename h as host b as bytes&lt;BR /&gt;
| eval my_splunk_server = splunk_server &lt;BR /&gt;
| fields source mysourcetype host bytes pool originator my_splunk_server &lt;BR /&gt;
| eval mbytes=((bytes/1024)/1024) &lt;BR /&gt;
| stats sum(mbytes) as mbytes by host &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:29:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180680#M52056</guid>
      <dc:creator>rdelmark</dc:creator>
      <dc:date>2020-09-28T15:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Stats Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180681#M52057</link>
      <description>&lt;P&gt;I think something like this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_internal" source="*license_usage.log" 
| rename h as host b as bytes
| eval my_splunk_server = splunk_server 
| fields source mysourcetype host bytes pool originator my_splunk_server 
| eval mbytes=((bytes/1024)/1024) 
| stats sum(mbytes) as mbytes by host
| sort -mbytes
| head 5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Dec 2013 00:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180681#M52057</guid>
      <dc:creator>bruceclarke</dc:creator>
      <dc:date>2013-12-17T00:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Stats Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180682#M52058</link>
      <description>&lt;P&gt;I as far as I know, the stats command, especially what your have written,  should not be providing any OVERALL total. Would you mind sharing the final output (tabular) before chart command. Also to get top 5, you can sort by mbytes and use "| head 5" in the end of search.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2013 00:43:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180682#M52058</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-12-17T00:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using Stats Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180683#M52059</link>
      <description>&lt;P&gt;Here are the results I get when I added the Head 5 and sort commands suggested. It is showing the overall TOTAL mybtes used for the 24hr period, as well as the mbtyes used for each host. When I then click on the results chart icon to turn it into a bar chart it looks bad because I am charting the Total mbytes used for the entire day when I only want a chart with the individual hosts.&lt;/P&gt;

&lt;P&gt;host            mbytes&lt;BR /&gt;
            39891.08222&lt;BR /&gt;
scom01ms162 163.468506&lt;BR /&gt;
dcmenprd1   163.271321&lt;BR /&gt;
splk01as162 160.080222&lt;BR /&gt;
sfp01spare  135.03406&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2013 16:07:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Stats-Command/m-p/180683#M52059</guid>
      <dc:creator>rdelmark</dc:creator>
      <dc:date>2013-12-17T16:07:09Z</dc:date>
    </item>
  </channel>
</rss>

