<?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 do I get min/max of a column chart PER field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388294#M113221</link>
    <description>&lt;P&gt;Hey guys, I'm still stuck. I'd like the graphs to look the way they are, but have the min/max label be for each category (CPU, memory, swap) NOT the date. Right now, it's giving me the min/max for the date field only. Please help! &lt;/P&gt;</description>
    <pubDate>Thu, 04 Oct 2018 22:56:23 GMT</pubDate>
    <dc:creator>josephinemho</dc:creator>
    <dc:date>2018-10-04T22:56:23Z</dc:date>
    <item>
      <title>How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388289#M113216</link>
      <description>&lt;P&gt;I created values for the average CPU, memory and swap memory usage and managed to get it in a column chart. I'd like to get the chart to display the min/max of each field (cpu, memory, swap) — not the min/max of all the fields by date.&lt;/P&gt;

&lt;P&gt;Here is my query and what my chart currently looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os (sourcetype=cpu cpu=all) OR (sourcetype=vmstat) 
| search host=$server_name$
| eval Percent_CPU_Load = 100 - pctIdle 
| eval date=strftime(_time,"%A") 
| stats avg(Percent_CPU_Load) avg(memUsedPct) avg(swapUsedPct) by date 
| rename avg(Percent_CPU_Load) AS "Avg CPU" avg(memUsedPct) as "Avg Memory" avg(swapUsedPct) AS "Avg Swap Memory"
| stats values by myvalues
| eval sort_field = case(date=="Monday",1, date=="Tuesday",2, date=="Wednesday",3, date=="Thursday",4, date=="Friday",5, date=="Saturday",6, date=="Sunday",7)
| sort sort_field
| fields - sort_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5818i26E2DEABD49C77D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 16:45:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388289#M113216</guid>
      <dc:creator>josephinemho</dc:creator>
      <dc:date>2018-09-21T16:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388290#M113217</link>
      <description>&lt;P&gt;| streamstats max(Avg CPU), min(Avg CPU) as max_cpu, min_cpu&lt;BR /&gt;
Go to source code and add this max_cpu, min_cpu and see if it works. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:21:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388290#M113217</guid>
      <dc:creator>sandeepmakkena</dc:creator>
      <dc:date>2020-09-29T21:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388291#M113218</link>
      <description>&lt;P&gt;your line 7 doesn't make any sense, and line 6 renames should be done on line 5 at the same time as the avg are calculated.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 18:39:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388291#M113218</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-09-21T18:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388292#M113219</link>
      <description>&lt;P&gt;Oh whoops, you're right. I forgot to remove line 7 from a previous search. Just moved up the rename to line 6 so it now looks like this - thanks @DalJeanis! &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats avg(Percent_CPU_Load) AS "Avg CPU" avg(memUsedPct) as "Avg Memory" avg(swapUsedPct) AS "Avg Swap" by date 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Sep 2018 22:18:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388292#M113219</guid>
      <dc:creator>josephinemho</dc:creator>
      <dc:date>2018-09-21T22:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388293#M113220</link>
      <description>&lt;P&gt;Try the code below, I took a few liberties based on my test environment, such as bin'ing the data at 1m intervals and averaging those values (in case any are sampled more than 1m at a time.  You'll also need to add your additional sort logic if you still need this.   If you visualize this as a bar graph and enable Trellis it looks something like:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5817i9BBEEB448EB1A764/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os (sourcetype=cpu cpu=all) OR (sourcetype=vmstat) 
 | table _time,pctIdle,swapUsedPct,memUsedPct
 | bin _time span=1m
 | stats avg(pctIdle) as cpu, avg(memUsedPct) as mem, avg(swapUsedPct) as swap by _time
 | eval values=mvappend(values,if(isnull(cpu),null,"cpu="+tostring(cpu)),if(isnull(swap),null,"swap="+tostring(swap)),if(isnull(mem),null,"mem="+tostring(mem)))
 | fields - cpu,mem,swap
 | mvexpand values
 | rex field=values "(?P&amp;lt;stat&amp;gt;.*)=(?P&amp;lt;value&amp;gt;.*)"
 | fields - values
 | stats avg(value) as avg,max(value) as max,min(value) as min by stat
 | eval caption=case(stat="cpu","CPU Usage",stat="mem","Memory Used",stat=swap,"Swap Used")
 | fields stat,caption,avg,max,min
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Sep 2018 00:16:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388293#M113220</guid>
      <dc:creator>grawlinsonperso</dc:creator>
      <dc:date>2018-09-22T00:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388294#M113221</link>
      <description>&lt;P&gt;Hey guys, I'm still stuck. I'd like the graphs to look the way they are, but have the min/max label be for each category (CPU, memory, swap) NOT the date. Right now, it's giving me the min/max for the date field only. Please help! &lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 22:56:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388294#M113221</guid>
      <dc:creator>josephinemho</dc:creator>
      <dc:date>2018-10-04T22:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388295#M113222</link>
      <description>&lt;P&gt;I removed that line (it was just leftover from a previous search), but I still have the same problem with my charts not displaying min/max of a column chart by the values generated with &lt;CODE&gt;stats&lt;/CODE&gt; - (not by date). &lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 22:57:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388295#M113222</guid>
      <dc:creator>josephinemho</dc:creator>
      <dc:date>2018-10-04T22:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388296#M113223</link>
      <description>&lt;P&gt;Hi there, I don't understand what you mean. Can you show me where your suggestion fits in my query? &lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 22:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388296#M113223</guid>
      <dc:creator>josephinemho</dc:creator>
      <dc:date>2018-10-04T22:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get min/max of a column chart PER field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388297#M113224</link>
      <description>&lt;P&gt;Hi, I don't see the min/max labels on your chart...also, I'm on Splunk 6.5 so we don't have Trellis available &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 22:59:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-min-max-of-a-column-chart-PER-field/m-p/388297#M113224</guid>
      <dc:creator>josephinemho</dc:creator>
      <dc:date>2018-10-04T22:59:30Z</dc:date>
    </item>
  </channel>
</rss>

