<?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: What is wrong with this stats, eval query used to count the input fields to represent in an area chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387386#M174495</link>
    <description>&lt;P&gt;I even did try this way, but it's not working&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=qvmr_soc_r groupID=socdv_data_mine  stat=Run user=$userid$  mem_req&amp;lt;$max_mem_req$ mem_req&amp;gt;$min_mem_req$  | eval bool_1 = if(($min_mem_req$&amp;gt;=0) AND ($max_mem_req$ &amp;lt;= 32), 1, 0)   |  eval bool_2 = if(($min_mem_req$&amp;gt;32) AND ($max_mem_req$ &amp;lt;= 64), 1, 0) | eval bool_3 = if(($min_mem_req$&amp;gt;64) AND ($max_mem_req$ &amp;lt;= 128), 1, 0) | eval bool_4 = if(($min_mem_req$&amp;gt;128) AND ($max_mem_req$ &amp;lt;= 1024), 1, 0) | stats sum(bool_1) as mem_0_32 | stats sum(bool_2) as mem_32_64 | stats sum(bool_3) as mem_64_128 | stats sum(bool_4) as mem_above_128 |  timechart span=30m count by mem_req
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Nov 2018 19:22:39 GMT</pubDate>
    <dc:creator>krs_1507</dc:creator>
    <dc:date>2018-11-16T19:22:39Z</dc:date>
    <item>
      <title>What is wrong with this stats, eval query used to count the input fields to represent in an area chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387385#M174494</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I wanted to keep account for the memory usage of all the jobs that are running in a range from 0 to 1024G.&lt;BR /&gt;
Like separate count for  0-32, 32-64, 64-128, &amp;gt;128  ranges for every 30 Minutes.&lt;/P&gt;

&lt;P&gt;I'm trying to do it like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=qvmr_soc_r groupID=socdv_data_mine  stat=Run user=$userid$  mem_req&amp;lt;$max_mem_req$ mem_req&amp;gt;$min_mem_req$   |stats mem_0_32(eval(($min_mem_req$&amp;gt;=0) AND ($max_mem_req$ &amp;lt;= 8))) as mem_0_32 |stats mem_32_64(eval(($min_mem_req$&amp;gt;32) AND ($max_mem_req$ &amp;lt;=64))) as mem_32_64 |stats mem_64_128(eval(($min_mem_req$&amp;gt;64) AND ($max_mem_req$ &amp;lt;=128))) as mem_64_128 | stats mem_above_128(eval(($min_mem_req$&amp;gt;128) AND ($max_mem_req$ &amp;lt;=1024))) as mem_above_128| timechart span=30m count by mem_req
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where $userid$, $min_mem_req, and $max_mem_req are Input fields&lt;/P&gt;

&lt;P&gt;I'm getting the below error&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Error in 'stats' command: The argument 'mem_0_32(eval((0&amp;gt;=0) AND (1024&amp;lt;= 8)))' is invalid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you please let me know the correct usage of this?&lt;/P&gt;

&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;

&lt;P&gt;Ravi&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:00:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387385#M174494</guid>
      <dc:creator>krs_1507</dc:creator>
      <dc:date>2020-09-29T22:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this stats, eval query used to count the input fields to represent in an area chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387386#M174495</link>
      <description>&lt;P&gt;I even did try this way, but it's not working&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=qvmr_soc_r groupID=socdv_data_mine  stat=Run user=$userid$  mem_req&amp;lt;$max_mem_req$ mem_req&amp;gt;$min_mem_req$  | eval bool_1 = if(($min_mem_req$&amp;gt;=0) AND ($max_mem_req$ &amp;lt;= 32), 1, 0)   |  eval bool_2 = if(($min_mem_req$&amp;gt;32) AND ($max_mem_req$ &amp;lt;= 64), 1, 0) | eval bool_3 = if(($min_mem_req$&amp;gt;64) AND ($max_mem_req$ &amp;lt;= 128), 1, 0) | eval bool_4 = if(($min_mem_req$&amp;gt;128) AND ($max_mem_req$ &amp;lt;= 1024), 1, 0) | stats sum(bool_1) as mem_0_32 | stats sum(bool_2) as mem_32_64 | stats sum(bool_3) as mem_64_128 | stats sum(bool_4) as mem_above_128 |  timechart span=30m count by mem_req
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 19:22:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387386#M174495</guid>
      <dc:creator>krs_1507</dc:creator>
      <dc:date>2018-11-16T19:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this stats, eval query used to count the input fields to represent in an area chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387387#M174496</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/150968"&gt;@krs_1507&lt;/a&gt; your requirement and your query does not add up. &lt;/P&gt;

&lt;P&gt;If you just need to chart various ranges of memory usage every 30 minute you can try something like the following run anywhere search based on Splunk's _internal index (field used is &lt;CODE&gt;date_second&lt;/CODE&gt; instead of mem_req):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal sourcetype=splunkd  date_second&amp;gt;=0 date_second&amp;lt;60
| timechart span=30m count(eval(date_second&amp;gt;=0 AND date_second&amp;lt;20)) as date_second_0_to_20 count(eval(date_second&amp;gt;=20 AND date_second&amp;lt;40)) as date_second_20_to_40 count(eval(date_second&amp;gt;=40 AND date_second&amp;lt;60)) as date_second_40_to_60
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: date_second is just for run anywhere example and as obvious its value will always be between 0-60.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:00:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387387#M174496</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T22:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this stats, eval query used to count the input fields to represent in an area chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387388#M174497</link>
      <description>&lt;P&gt;To count events by a set of ranges you can generically do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | bin span=32 mem_req | timechart span=30m count by mem_req
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Nov 2018 19:06:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387388#M174497</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-11-17T19:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this stats, eval query used to count the input fields to represent in an area chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387389#M174498</link>
      <description>&lt;P&gt;First of all the mem_0_32 is not a correct function for &lt;CODE&gt;stats&lt;/CODE&gt; thats why splunk complained about it. And for counting the events based on the range of memory values, you can use the way &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt; has mentioned. Also you can try &lt;CODE&gt;rangemap&lt;/CODE&gt; command. Run this sample search and modify according to your requirement. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval min_mem_req="20,40,60,80" | eval max_mem_req="30,50,70,90" | makemv delim="," min_mem_req | makemv delim="," max_mem_req | mvexpand min_mem_req | mvexpand max_mem_req | eval range=case(min_mem_req&amp;gt;=0 AND max_mem_req&amp;lt;= 8,"mem_0_32",min_mem_req&amp;gt;32 AND max_mem_req&amp;lt;=64,"mem_32_64",min_mem_req&amp;gt;64 AND max_mem_req&amp;lt;=128,"mem_64_128",min_mem_req&amp;gt;128 AND max_mem_req&amp;lt;=1024,"mem_above_128") | fillnull range value="No Range" | timechart count by range
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:00:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-wrong-with-this-stats-eval-query-used-to-count-the-input/m-p/387389#M174498</guid>
      <dc:creator>macadminrohit</dc:creator>
      <dc:date>2020-09-29T22:00:58Z</dc:date>
    </item>
  </channel>
</rss>

