<?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: Show max ,minimum and average values from a pool of host machines on a chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Show-max-minimum-and-average-values-from-a-pool-of-host-machines/m-p/463854#M130755</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;cs_dataowner_id="ICTO-18172" cs_stage="PROD" source="dqs" "FetchTradesHistoric invoked"
| timechart span=15m count as calls by host
| eventstats max(calls) as max_calls min(calls) as min_calls avg(calls) as average_calls
| stats values(max_calls) as max_calls, values(min_calls) as min_calls, values(average_calls) as average_calls
 ,values(eval(if(calls==max_calls), host, NULL)) as max_calls_host
 ,values(eval(if(calls==min_calls), host, NULL)) as min_calls_host
 ,values(eval(if(calls &amp;gt; average_calls), host, NULL)) as over_avg_host
 ,values(eval(if(calls &amp;lt; average_calls), host, NULL)) as under_avg_host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi,&lt;BR /&gt;
After timechart, calculate the maximum value etc. with eventstats and display it with stats.&lt;/P&gt;

&lt;H2&gt;How about this?&lt;/H2&gt;

&lt;P&gt;Sorry, The query was wrong.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=10
| streamstats count
| eval host="host_".count
| eval calls=random() % 100
`comment("This is dummy data")`
| eventstats max(calls) as max_calls min(calls) as min_calls avg(calls) as average_calls
`comment("Change stats query")`
| stats values(max_calls) as max_calls, values(min_calls) as min_calls, values(average_calls) as average_calls
  ,values(eval(if(calls==max_calls, host, NULL))) as max_calls_host
  ,values(eval(if(calls==min_calls, host, NULL))) as min_calls_host
  ,values(eval(if(calls &amp;gt; average_calls, host, NULL))) as over_avg_host
  ,values(eval(if(calls &amp;lt; average_calls, host, NULL))) as under_avg_host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think this is all right.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Oct 2019 10:38:42 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2019-10-21T10:38:42Z</dc:date>
    <item>
      <title>Show max ,minimum and average values from a pool of host machines on a chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-max-minimum-and-average-values-from-a-pool-of-host-machines/m-p/463853#M130754</link>
      <description>&lt;P&gt;I have the follow search which shows the call count  being made to a number of hosts every 15mins&lt;/P&gt;

&lt;P&gt;"cs_dataowner_id="ICTO-18172" cs_stage="PROD" |search source="&lt;EM&gt;dqs&lt;/EM&gt;"| search "FetchTradesHistoric invoked"|timechart count as calls by host span=15m"&lt;/P&gt;

&lt;P&gt;I want to show on a chart for each 15 min span the host which has had the max count, the minimum count and the overall average count &lt;/P&gt;

&lt;P&gt;The purpose being it gives the user an idea of what host is being over and under utilized and allows it compare it against the average&lt;/P&gt;

&lt;P&gt;Any ideas how I can incorporate that in a chart ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:40:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-max-minimum-and-average-values-from-a-pool-of-host-machines/m-p/463853#M130754</guid>
      <dc:creator>jbassi1</dc:creator>
      <dc:date>2020-09-30T02:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Show max ,minimum and average values from a pool of host machines on a chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-max-minimum-and-average-values-from-a-pool-of-host-machines/m-p/463854#M130755</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;cs_dataowner_id="ICTO-18172" cs_stage="PROD" source="dqs" "FetchTradesHistoric invoked"
| timechart span=15m count as calls by host
| eventstats max(calls) as max_calls min(calls) as min_calls avg(calls) as average_calls
| stats values(max_calls) as max_calls, values(min_calls) as min_calls, values(average_calls) as average_calls
 ,values(eval(if(calls==max_calls), host, NULL)) as max_calls_host
 ,values(eval(if(calls==min_calls), host, NULL)) as min_calls_host
 ,values(eval(if(calls &amp;gt; average_calls), host, NULL)) as over_avg_host
 ,values(eval(if(calls &amp;lt; average_calls), host, NULL)) as under_avg_host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi,&lt;BR /&gt;
After timechart, calculate the maximum value etc. with eventstats and display it with stats.&lt;/P&gt;

&lt;H2&gt;How about this?&lt;/H2&gt;

&lt;P&gt;Sorry, The query was wrong.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=10
| streamstats count
| eval host="host_".count
| eval calls=random() % 100
`comment("This is dummy data")`
| eventstats max(calls) as max_calls min(calls) as min_calls avg(calls) as average_calls
`comment("Change stats query")`
| stats values(max_calls) as max_calls, values(min_calls) as min_calls, values(average_calls) as average_calls
  ,values(eval(if(calls==max_calls, host, NULL))) as max_calls_host
  ,values(eval(if(calls==min_calls, host, NULL))) as min_calls_host
  ,values(eval(if(calls &amp;gt; average_calls, host, NULL))) as over_avg_host
  ,values(eval(if(calls &amp;lt; average_calls, host, NULL))) as under_avg_host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think this is all right.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 10:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-max-minimum-and-average-values-from-a-pool-of-host-machines/m-p/463854#M130755</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-10-21T10:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Show max ,minimum and average values from a pool of host machines on a chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-max-minimum-and-average-values-from-a-pool-of-host-machines/m-p/463855#M130756</link>
      <description>&lt;P&gt;Thanks for the response&lt;/P&gt;

&lt;P&gt;I'm not sure whether it down to the version of Splunk I am using , which is Splunk Version ...6.6.6.1,  but the below line does not return any results &lt;/P&gt;

&lt;P&gt;cs_dataowner_id="ICTO-18172" cs_stage="PROD" source="dqs" "FetchTradesHistoric invoked" | timechart span=15m count as calls by host&lt;/P&gt;

&lt;P&gt;I have to use my original format below to get a resultset which it does for each host &lt;BR /&gt;
cs_dataowner_id="ICTO-18172" cs_stage="PROD" |search source="&lt;EM&gt;dqs&lt;/EM&gt;"| search "FetchTradesHistoric invoked"|timechart span=15m count as calls by host| eventstats max(calls) as max_calls min(calls) as min_calls avg(calls) as average_calls&lt;/P&gt;

&lt;P&gt;To the above search if I then try to append the below again get no results is this a version or format issue ?&lt;BR /&gt;
"| stats values(max_calls) as max_calls, values(min_calls) as min_calls, values(average_calls) as average_calls"&lt;/P&gt;

&lt;P&gt;If I do the full search with the eval function included I get the syntax error below &lt;BR /&gt;
"⚠    Error in 'stats' command: The eval expression for dynamic field 'eval(if(calls==max_calls), host, NULL)' is invalid. Error='The operator at ', host, NULL' is invalid.' "&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:34:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-max-minimum-and-average-values-from-a-pool-of-host-machines/m-p/463855#M130756</guid>
      <dc:creator>jbassi1</dc:creator>
      <dc:date>2020-09-30T02:34:46Z</dc:date>
    </item>
  </channel>
</rss>

