<?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 edit my search to append a total average column for a chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272335#M81963</link>
    <description>&lt;P&gt;hmmm .... returns 0 results&lt;/P&gt;</description>
    <pubDate>Tue, 25 Oct 2016 17:09:54 GMT</pubDate>
    <dc:creator>splunkin11</dc:creator>
    <dc:date>2016-10-25T17:09:54Z</dc:date>
    <item>
      <title>How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272333#M81961</link>
      <description>&lt;P&gt;I can't seem to find a solution for this. I've created a chart over a given time span. I've been able to add a column for the totals for each row and total averages at the bottom but have not been able to figure out how to add a column for the average of whatever the selected time span would be.&lt;BR /&gt;
What I have so far ....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*
| bucket _time span=1d  
|convert ctime(_time) AS date timeformat="%Y/%m/%d" 
| chart count over host by date 
| addtotals
| appendpipe [stats avg(* ) as *]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 16:01:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272333#M81961</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T16:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272334#M81962</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*
 | bucket _time span=1d  
 |convert ctime(_time) AS date timeformat="%Y/%m/%d" 
 | stats count by host date 
 | appendpipe [| stats avg(count) as count by host | eval date="Host_Avg" ]
 | xyseries host date count
 | addtotals
 | appendpipe [stats avg(* ) as *]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Final&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*
  | bucket _time span=1d 
  |convert ctime(_time) AS date timeformat="%Y/%m/%d" 
  | stats count by host date 
  | appendpipe [| stats avg(count) as count by host | eval date="Host Avg" ]
  | xyseries host date count
  | addtotals | eval Total=Total-'Host Avg'
  | appendpipe [stats avg(*) as * | foreach * [eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;') ] ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 16:14:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272334#M81962</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T16:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272335#M81963</link>
      <description>&lt;P&gt;hmmm .... returns 0 results&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 17:09:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272335#M81963</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T17:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272336#M81964</link>
      <description>&lt;P&gt;.. oops .. my fault ... getting results now and the avg. is correct and in a new column but the total column is now showing an incorrect total for the time span for each row.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 17:15:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272336#M81964</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T17:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272337#M81965</link>
      <description>&lt;P&gt;I see - it's including the  avg(count) # into the total count but how can I exclude the avg count from the total?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 17:21:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272337#M81965</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T17:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272338#M81966</link>
      <description>&lt;P&gt;Almost there. I found a way to add the correct total for each column with another appendcols but noticed that the final totals were lost - with the |appendpipe  [stats avg(* ) as *]&lt;/P&gt;

&lt;P&gt;Here's what I have now but missing the final totals:&lt;/P&gt;

&lt;P&gt;index=&lt;BR /&gt;
| bucket _time span=1d&lt;BR /&gt;&lt;BR /&gt;
|convert ctime(_time) AS date timeformat="%Y/%m/%d" &lt;BR /&gt;
| stats count by host date &lt;BR /&gt;
| appendpipe [| stats avg(count) as count by host | eval date="Host Avg" ]&lt;BR /&gt;
| xyseries host date count&lt;BR /&gt;
| appendcols [search index=&lt;BR /&gt;
| stats count as "Total Count" by host ]&lt;BR /&gt;
| appendpipe [stats avg(* ) as *]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:33:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272338#M81966</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2020-09-29T11:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272339#M81967</link>
      <description>&lt;P&gt;It would be better (efficient) to just add following after addtotals and before last appendpipe. (to avoid querying the host data again.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Total=Total-'Host Avg'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Full search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*
| bucket _time span=1d 
|convert ctime(_time) AS date timeformat="%Y/%m/%d" 
| stats count by host date 
| appendpipe [| stats avg(count) as count by host | eval date="Host Avg" ]
| xyseries host date count
| addtotals | eval Total=Total-'Host Avg'
| appendpipe [stats avg(*) as * ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272339#M81967</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T18:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272340#M81968</link>
      <description>&lt;P&gt;Great!! Your final answer fixes everything - thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:29:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272340#M81968</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T18:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272341#M81969</link>
      <description>&lt;P&gt;Would there be a way to round the final totals from using  [stats avg(*) as * ] ?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:16:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272341#M81969</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T19:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272342#M81970</link>
      <description>&lt;P&gt;Of course &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=*
 | bucket _time span=1d 
 |convert ctime(_time) AS date timeformat="%Y/%m/%d" 
 | stats count by host date 
 | appendpipe [| stats avg(count) as count by host | eval date="Host Avg" ]
 | xyseries host date count
 | addtotals | eval Total=Total-'Host Avg'
 | appendpipe [stats avg(*) as * | foreach * [eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;') ] ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:19:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272342#M81970</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T19:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272343#M81971</link>
      <description>&lt;P&gt;Wowzers!  That's something I've never seen or heard of before ... you're awesome!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:28:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272343#M81971</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T19:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272344#M81972</link>
      <description>&lt;P&gt;Glad to be of help. If there are no follow-up questions, you can close the question by accepting this answer.  I'll update my answer to reflect the final version of search.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:37:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272344#M81972</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T19:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272345#M81973</link>
      <description>&lt;P&gt;.. one small addition if you don't mind .. is there also a way to add a label for the last totals row produced from :&lt;BR /&gt;
| appendpipe [stats avg(*) as * | foreach * [eval "&amp;lt;&amp;gt;"=round('&amp;lt;&amp;gt;') ] ]&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:44:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272345#M81973</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T19:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272346#M81974</link>
      <description>&lt;P&gt;If by label you mean a value of say "Average by Host" (or something similar) on the 'host' field for very last row, yes. Just add this eval after the foreach command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....
 | appendpipe [stats avg(*) as * | foreach * [eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;') ]  | eval host="Average by Host"]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:47:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272346#M81974</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T19:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to append a total average column for a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272347#M81975</link>
      <description>&lt;P&gt;cool - thank you sir!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 20:00:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-append-a-total-average-column-for-a/m-p/272347#M81975</guid>
      <dc:creator>splunkin11</dc:creator>
      <dc:date>2016-10-25T20:00:03Z</dc:date>
    </item>
  </channel>
</rss>

