<?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 to create a stats table with field values based off of other fields in same stats table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-stats-table-with-field-values-based-off-of-other/m-p/238271#M70781</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=db device_type=router | timechart span=1d count by host | stats avg(count) AvgLogCount min(count) AS Min_Total max(count) AS Max_Total | rename host AS Host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 12 Mar 2016 16:56:51 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2016-03-12T16:56:51Z</dc:date>
    <item>
      <title>How to create a stats table with field values based off of other fields in same stats table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-stats-table-with-field-values-based-off-of-other/m-p/238269#M70779</link>
      <description>&lt;P&gt;Hello! I am sure my wording is way more complicated than what I want. Basically, the end result being a stats table along the lines of:&lt;/P&gt;

&lt;P&gt;Host    |  AvgLogCount   |   Min_Total   |     Max_Total&lt;BR /&gt;
Router1 |&lt;BR /&gt;
Router2 |&lt;/P&gt;

&lt;P&gt;And then the values filled in from there. The timespan in which I am looking at is 1 week. I was thinking using something along the lines of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=db device_type=router | timechart span=1d count | eventstats avg(count) as AvgLogCount, min(count) as Min, max(count) as Max
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I do this, there are X amount of rows that there are days, with the values matching the next row. I get why that is happening, but I want to turn it into each row listing a different Host, and the rest of the columns' value be of the respective host. Do I need something along the lines of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=db device_type=router | timechart span=1d count | eventstats avg(count) as AvgLogCount by host, min(count) as Min by host, max(count) as Max by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think that is on the right track, but it doesn't return anything. Any help would be greatly appreciated! And hopefully my wording makes sense.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-stats-table-with-field-values-based-off-of-other/m-p/238269#M70779</guid>
      <dc:creator>cmeyers</dc:creator>
      <dc:date>2020-09-29T09:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a stats table with field values based off of other fields in same stats table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-stats-table-with-field-values-based-off-of-other/m-p/238270#M70780</link>
      <description>&lt;P&gt;If you're looking for &lt;CODE&gt;per week&lt;/CODE&gt; stats (like avg log count per week, min/max by week), then try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=db device_type=router | bucket span=1w _time | stats count  by _time host | stats avg(count) as AvgLogCount min(count) as Min max(count) as Max by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2016 00:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-stats-table-with-field-values-based-off-of-other/m-p/238270#M70780</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-09T00:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a stats table with field values based off of other fields in same stats table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-stats-table-with-field-values-based-off-of-other/m-p/238271#M70781</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=db device_type=router | timechart span=1d count by host | stats avg(count) AvgLogCount min(count) AS Min_Total max(count) AS Max_Total | rename host AS Host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Mar 2016 16:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-stats-table-with-field-values-based-off-of-other/m-p/238271#M70781</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-03-12T16:56:51Z</dc:date>
    </item>
  </channel>
</rss>

