<?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: To Remove values with '0' from the calculation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681744#M232965</link>
    <description>&lt;P&gt;I do not believe that &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mstats#Comparison_expression_options" target="_blank" rel="noopener"&gt;mstats&lt;/A&gt;&amp;nbsp;supports filtering by metric value. &amp;nbsp;But the question is also too vague. &amp;nbsp;Maybe you can explain your use case? &amp;nbsp;What does "remove values with '0'" mean? &amp;nbsp;From what calculation? &amp;nbsp;Given the three sample values you illustrated for metric &lt;U&gt;calc:service.thaa_stress_requests_lr_tags&lt;/U&gt;, what is desired result from avg(calc:service.thaa_stress_requests_lr_tags)? &amp;nbsp;If your search period contains these three values, is the actual result&amp;nbsp;&lt;SPAN&gt;2602841.3333333335, i.e., (4115725 + 0 +&amp;nbsp;3692799) / 3? &amp;nbsp;Why do you want it to be different from the definition?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Further more, what method do you use to reveal those three values? &amp;nbsp;Metrics index cannot be searched as index search. &amp;nbsp;mstats can only give you aggregations. &amp;nbsp;Even if you group by _timeseries, you still only get aggregations. &amp;nbsp;This returns to the fundamental question: What is the point of "removing values with '0'"?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 23 Mar 2024 07:51:47 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2024-03-23T07:51:47Z</dc:date>
    <item>
      <title>To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681672#M232941</link>
      <description>&lt;P&gt;I have below query to calculate average response times. For some reason some times the value is coming as '0'. i wanted to remove those values from my calculation.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| mstats sum(calc:service.thaa_stress_requests_count_lr_tags) As "Count" ,avg(calc:service.thaa_stress_requests_lr_tags) As "Response" where index=itsi_im_metrics by Dimension.id
| eval Response=round((Response/1000000),2), Count=round(Count,0)
| search Dimension.id IN ("*Process.aspx")&lt;/LI-CODE&gt;
&lt;P&gt;-- Sample Values&amp;nbsp;&lt;/P&gt;
&lt;P&gt;metric_name:calc:service.thaa_stress_requests_lr_tags:&amp;nbsp;4115725&lt;/P&gt;
&lt;P&gt;metric_name:calc:service.thaa_stress_requests_lr_tags: 0&lt;/P&gt;
&lt;P&gt;metric_name:calc:service.thaa_stress_requests_lr_tags:&amp;nbsp;3692799&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 14:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681672#M232941</guid>
      <dc:creator>sabari80</dc:creator>
      <dc:date>2024-03-22T14:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681673#M232942</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats sum(eval(if('calc:service.thaa_stress_requests_count_lr_tags'&amp;gt;0, 'calc:service.thaa_stress_requests_count_lr_tags', null()))) As "Count", avg(eval(if('calc:service.thaa_stress_requests_lr_tags'&amp;gt;0, 'calc:service.thaa_stress_requests_lr_tags', null()))) As "Response" where index=itsi_im_metrics by Dimension.id&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Mar 2024 13:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681673#M232942</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-22T13:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681675#M232944</link>
      <description>&lt;P&gt;getting error -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Error in 'mstats' command: Invalid token:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sum(eval(if('calc:service.thaa_stress_requests_count_lr_tags'&amp;gt;0&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Mar 2024 14:06:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681675#M232944</guid>
      <dc:creator>sabari80</dc:creator>
      <dc:date>2024-03-22T14:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681701#M232947</link>
      <description>&lt;P&gt;Try without quotes around the field names (perhaps there is something significant about the colon?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats sum(eval(if(calc:service.thaa_stress_requests_count_lr_tags&amp;gt;0, calc:service.thaa_stress_requests_count_lr_tags, null()))) As "Count", avg(eval(if(calc:service.thaa_stress_requests_lr_tags&amp;gt;0, calc:service.thaa_stress_requests_lr_tags, null()))) As "Response" where index=itsi_im_metrics by Dimension.id&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Mar 2024 16:23:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681701#M232947</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-22T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681702#M232948</link>
      <description>&lt;P&gt;yes tried it out with all options already, with quote, without quote &amp;amp; double quotes. All are giving the same error.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Error in 'mstats' command: &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Invalid token: sum(eval(if(calc:service.thaa_stress_requests_count_lr_tags&amp;gt;0&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 18:40:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681702#M232948</guid>
      <dc:creator>sabari80</dc:creator>
      <dc:date>2024-03-22T18:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681744#M232965</link>
      <description>&lt;P&gt;I do not believe that &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mstats#Comparison_expression_options" target="_blank" rel="noopener"&gt;mstats&lt;/A&gt;&amp;nbsp;supports filtering by metric value. &amp;nbsp;But the question is also too vague. &amp;nbsp;Maybe you can explain your use case? &amp;nbsp;What does "remove values with '0'" mean? &amp;nbsp;From what calculation? &amp;nbsp;Given the three sample values you illustrated for metric &lt;U&gt;calc:service.thaa_stress_requests_lr_tags&lt;/U&gt;, what is desired result from avg(calc:service.thaa_stress_requests_lr_tags)? &amp;nbsp;If your search period contains these three values, is the actual result&amp;nbsp;&lt;SPAN&gt;2602841.3333333335, i.e., (4115725 + 0 +&amp;nbsp;3692799) / 3? &amp;nbsp;Why do you want it to be different from the definition?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Further more, what method do you use to reveal those three values? &amp;nbsp;Metrics index cannot be searched as index search. &amp;nbsp;mstats can only give you aggregations. &amp;nbsp;Even if you group by _timeseries, you still only get aggregations. &amp;nbsp;This returns to the fundamental question: What is the point of "removing values with '0'"?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2024 07:51:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681744#M232965</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-03-23T07:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681748#M232967</link>
      <description>&lt;P&gt;using mpreview command to explore the results&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| mpreview index=itsi_im_metrics | search "calc:service.thaa_stress_requests_lr_tags" "Dimension.id"="*Process.aspx"&lt;/LI-CODE&gt;
&lt;P&gt;Those values with '0' is not actual response, for some reason these entries are there and its affecting the overall average response. so wanted to remove those values from the calculation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead of this --&amp;gt;&amp;nbsp;&lt;SPAN&gt;(4115725 + 0 +&amp;nbsp;3692799) / 3, i want this --&amp;gt;&amp;nbsp;(4115725 + 3692799) / 2&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2024 15:51:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681748#M232967</guid>
      <dc:creator>sabari80</dc:creator>
      <dc:date>2024-03-23T15:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: To Remove values with '0' from the calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681761#M232974</link>
      <description>&lt;P&gt;Thank you for introducing msearch aka mpreview. &amp;nbsp;As I mentioned before, mstats doesn't allow filtering by value. &amp;nbsp;So, you need to take care of stats after mpreview. &amp;nbsp;Something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mpreview index=itsi_im_metrics
| search Dimension.id IN ("*Process.aspx")
 calc:service.thaa_stress_requests_count_lr_tags&amp;gt;0  calc:service.thaa_stress_requests_lr_tags &amp;gt; 0
| stats sum(calc:service.thaa_stress_requests_count_lr_tags) As "Count" ,
  avg(calc:service.thaa_stress_requests_lr_tags) As "Response"
  by Dimension.id
| eval Response=round((Response/1000000),2), Count=round(Count,0)&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 24 Mar 2024 05:48:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-Remove-values-with-0-from-the-calculation/m-p/681761#M232974</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-03-24T05:48:29Z</dc:date>
    </item>
  </channel>
</rss>

