<?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 can I get box and whisker plot values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53728#M13070</link>
    <description>&lt;P&gt;You have at least three problems with your search:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;When comparing two fields, you cannot use &lt;CODE&gt;search&lt;/CODE&gt; - you must use &lt;CODE&gt;where&lt;/CODE&gt;.  &lt;CODE&gt;search&lt;/CODE&gt; always assumes that the value to the right of the comparator is a string literal, whereas &lt;CODE&gt;where&lt;/CODE&gt; will treat the right-hand side as a field.&lt;/LI&gt;
&lt;LI&gt;In your comparison, you are attempting to compare &lt;CODE&gt;lfence&lt;/CODE&gt; and &lt;CODE&gt;ufence&lt;/CODE&gt; to &lt;CODE&gt;bar&lt;/CODE&gt; - however, &lt;CODE&gt;bar&lt;/CODE&gt; is no longer a valid field in the result set after you invoke the &lt;CODE&gt;stats&lt;/CODE&gt; command.  Take a look at the tabular output of just the initial search and &lt;CODE&gt;stats&lt;/CODE&gt; to see what I mean.&lt;/LI&gt;
&lt;LI&gt;You need to use an explicit &lt;CODE&gt;AND&lt;/CODE&gt; in your &lt;CODE&gt;where&lt;/CODE&gt; clause (as well as if you were using a &lt;CODE&gt;search&lt;/CODE&gt; clause)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;You probably want to do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo 
|eventstats p25(bar) as q1, p50(bar) as bmed, p75(bar) as q3
|eval irq=q3-q1
|eval lfence=q1-1.5*irq
|eval ufence=q3+1.5*irq
|where bar&amp;gt;=lfence AND bar&amp;lt;=ufence
|stats min(bar) as lfence max(bar) as ufence values(q1) as q1 values(bmed) as bmed values(q3) as q3 values(irq) as irq
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 May 2012 00:16:30 GMT</pubDate>
    <dc:creator>araitz</dc:creator>
    <dc:date>2012-05-18T00:16:30Z</dc:date>
    <item>
      <title>How can I get box and whisker plot values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53725#M13067</link>
      <description>&lt;P&gt;I don't have any problem getting the Q1, Median, Q3, and IQR values using percX(), median and eval. What I'm having trouble with is separating the outliers from the rest of the data. I'm trying to do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo 
|stats p25(bar) as q1, p50(bar) as bmed, p75(bar) as q3
|eval irq=q3-q1
|eval lfence=q1-1.5*iqr
|eval ufence=q3+1.5*iqr
|search bar&amp;gt;=lfence bar&amp;lt;=ufence
|stats min(bar) as lfence, max(bar) as ufence
|table lfence,q1,bmed,q3,ufence,iqr
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However this returns no results. Does anyone know how I can get these values? I know outlier uses IQR to remove outliers, but if I used that first it would change the median, q1, q3 and iqr.&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 20:37:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53725#M13067</guid>
      <dc:creator>caffein</dc:creator>
      <dc:date>2012-05-16T20:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get box and whisker plot values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53726#M13068</link>
      <description>&lt;P&gt;Perhaps you mean &lt;CODE&gt;| search bar&amp;gt;=lfence ...&lt;/CODE&gt; rather than &lt;CODE&gt;| select...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Unless select is some brand new or custom search command I am unaware of, I think that is your problem.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2012 22:03:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53726#M13068</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2012-05-17T22:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get box and whisker plot values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53727#M13069</link>
      <description>&lt;P&gt;I wish it were that simple, but that was just a typo. Changing select to search doesn't help at all, and I still get no results back. If I remove the last 3 lines I can get the q1,median,q3 and iqr though.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2012 22:32:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53727#M13069</guid>
      <dc:creator>caffein</dc:creator>
      <dc:date>2012-05-17T22:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get box and whisker plot values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53728#M13070</link>
      <description>&lt;P&gt;You have at least three problems with your search:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;When comparing two fields, you cannot use &lt;CODE&gt;search&lt;/CODE&gt; - you must use &lt;CODE&gt;where&lt;/CODE&gt;.  &lt;CODE&gt;search&lt;/CODE&gt; always assumes that the value to the right of the comparator is a string literal, whereas &lt;CODE&gt;where&lt;/CODE&gt; will treat the right-hand side as a field.&lt;/LI&gt;
&lt;LI&gt;In your comparison, you are attempting to compare &lt;CODE&gt;lfence&lt;/CODE&gt; and &lt;CODE&gt;ufence&lt;/CODE&gt; to &lt;CODE&gt;bar&lt;/CODE&gt; - however, &lt;CODE&gt;bar&lt;/CODE&gt; is no longer a valid field in the result set after you invoke the &lt;CODE&gt;stats&lt;/CODE&gt; command.  Take a look at the tabular output of just the initial search and &lt;CODE&gt;stats&lt;/CODE&gt; to see what I mean.&lt;/LI&gt;
&lt;LI&gt;You need to use an explicit &lt;CODE&gt;AND&lt;/CODE&gt; in your &lt;CODE&gt;where&lt;/CODE&gt; clause (as well as if you were using a &lt;CODE&gt;search&lt;/CODE&gt; clause)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;You probably want to do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo 
|eventstats p25(bar) as q1, p50(bar) as bmed, p75(bar) as q3
|eval irq=q3-q1
|eval lfence=q1-1.5*irq
|eval ufence=q3+1.5*irq
|where bar&amp;gt;=lfence AND bar&amp;lt;=ufence
|stats min(bar) as lfence max(bar) as ufence values(q1) as q1 values(bmed) as bmed values(q3) as q3 values(irq) as irq
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 May 2012 00:16:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53728#M13070</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2012-05-18T00:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get box and whisker plot values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53729#M13071</link>
      <description>&lt;P&gt;You also have a typo - &lt;CODE&gt;irq&lt;/CODE&gt; vs. &lt;CODE&gt;iqr&lt;/CODE&gt;.  See my answer below, I tested this on splunk's _internal index using "instantaneous_eps" rather than "bar".&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:50:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53729#M13071</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2020-09-28T11:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get box and whisker plot values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53730#M13072</link>
      <description>&lt;P&gt;YES! That did the trick. Thanks. I'm not that familiar with eventstats, and where, so I'll have to spend some time reading up on them.&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2012 00:48:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-box-and-whisker-plot-values/m-p/53730#M13072</guid>
      <dc:creator>caffein</dc:creator>
      <dc:date>2012-05-18T00:48:53Z</dc:date>
    </item>
  </channel>
</rss>

