<?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 filter results inside a chart... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95432#M24630</link>
    <description>&lt;P&gt;I am using:   &lt;/P&gt;

&lt;P&gt;… | chart sum(field1) over field2 by field3 &lt;/P&gt;

&lt;P&gt;to give me a nice chart of sums dependent on different fields.  I would like to filter this chart to only show some of the results.  How can I perform filtering based on the values inside the chart?  I only want data to show up if a value in a cell is greater than zero.  Or if only if one cell is greater than another cell.&lt;/P&gt;

&lt;P&gt;I also want to eliminate entire rows based on the values within the chart.  If a row contains a zero, I want to remove the entire row.&lt;/P&gt;

&lt;P&gt;I can get pieces of it, but I feel I am missing something, I hope it is not this complicated...  &lt;/P&gt;

&lt;P&gt;This post is close, but I don’t think it is what I need, I am not dealing with a count, I am only dealing with sum.  And I don’t have a static criteria I can eliminate values with, it is all based on comparisons to other values in the chart.&lt;BR /&gt;&lt;BR /&gt;
&lt;A href="http://answers.splunk.com/answers/12577/filter-a-chart" target="_blank"&gt;http://answers.splunk.com/answers/12577/filter-a-chart&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I seem to keep working in circles using a combination of eventstats, dedup, transaction, multi value commands… solving one issue, but hitting another proplem.  &lt;/P&gt;

&lt;P&gt;Any help would be appreciated.  &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;EDIT:&lt;/EM&gt;&lt;/STRONG&gt;  Add examples...  &lt;/P&gt;

&lt;P&gt;My logs could look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;## Date - Time - UserName - BytesSent - When  
10/1/2013 - 12:00:00 - Mike - 2 - Afternoon  
10/1/2013 - 12:03:00 - Mike - 1 - Afternoon  
...  
... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But lots and lots of them, with tons of UserNames.  The When field is always one of three values.  &lt;/P&gt;

&lt;P&gt;I then run a search:&lt;BR /&gt;&lt;BR /&gt;
... | chart sum(BytesSent) over UserName by When&lt;/P&gt;

&lt;P&gt;To take all these logs, sum the BytesSent based on the UserName and When fields.  Giving me a chart like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        Morning   Afternoon Evening
    Mike    1         7          3
    Steve   4         3          8
    Sue     6         5          6
    Bob     2         1          1
    Sara    3         0          2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to filter these results.  For example, I only want to show users who sent more in the evening than the afternoon.  So looking for this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        Morning   Afternoon Evening
    Steve   4         3          8
    Sue     6         5          6
    Sara    3         0          2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Some other ideas.... &lt;/P&gt;

&lt;P&gt;I have tried using eventstats to sum the fields and add the total to each log:&lt;BR /&gt;&lt;BR /&gt;
... | eventstats sum(BytesSend) as Total by UserName, When&lt;/P&gt;

&lt;P&gt;At this point I dont need all the logs anymore because the information I need is included in each one. So I can dedup:&lt;BR /&gt;&lt;BR /&gt;
... | dedup UserName When&lt;/P&gt;

&lt;P&gt;Now what....?  Use transaction to create multi value fields....?&lt;BR /&gt;&lt;BR /&gt;
.. | transaction UserName&lt;/P&gt;

&lt;P&gt;The problem is the order of the multi value fields is not consistent.  mvindex(Total,0) is not the same in each transaction.  It can be any of the three values, Morning, Afternoon, or Evening.  If it was consistent, we would be done.  I could ultimately use table to display the results and throw a | where at the end to do the filtering.&lt;/P&gt;

&lt;P&gt;... | table UserName Morning_Total Afternoon_Total Evening_Total | where Evening_Total&amp;gt;Afternoon_Total&lt;/P&gt;

&lt;P&gt;I guess there is some way I could use eval and if statements to get the values into the right places, but I seem to run into problems with this also.  &lt;/P&gt;

&lt;P&gt;My point is.... there has to be a simpler way..... &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:57:25 GMT</pubDate>
    <dc:creator>JWBailey</dc:creator>
    <dc:date>2020-09-28T14:57:25Z</dc:date>
    <item>
      <title>filter results inside a chart...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95432#M24630</link>
      <description>&lt;P&gt;I am using:   &lt;/P&gt;

&lt;P&gt;… | chart sum(field1) over field2 by field3 &lt;/P&gt;

&lt;P&gt;to give me a nice chart of sums dependent on different fields.  I would like to filter this chart to only show some of the results.  How can I perform filtering based on the values inside the chart?  I only want data to show up if a value in a cell is greater than zero.  Or if only if one cell is greater than another cell.&lt;/P&gt;

&lt;P&gt;I also want to eliminate entire rows based on the values within the chart.  If a row contains a zero, I want to remove the entire row.&lt;/P&gt;

&lt;P&gt;I can get pieces of it, but I feel I am missing something, I hope it is not this complicated...  &lt;/P&gt;

&lt;P&gt;This post is close, but I don’t think it is what I need, I am not dealing with a count, I am only dealing with sum.  And I don’t have a static criteria I can eliminate values with, it is all based on comparisons to other values in the chart.&lt;BR /&gt;&lt;BR /&gt;
&lt;A href="http://answers.splunk.com/answers/12577/filter-a-chart" target="_blank"&gt;http://answers.splunk.com/answers/12577/filter-a-chart&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I seem to keep working in circles using a combination of eventstats, dedup, transaction, multi value commands… solving one issue, but hitting another proplem.  &lt;/P&gt;

&lt;P&gt;Any help would be appreciated.  &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;EDIT:&lt;/EM&gt;&lt;/STRONG&gt;  Add examples...  &lt;/P&gt;

&lt;P&gt;My logs could look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;## Date - Time - UserName - BytesSent - When  
10/1/2013 - 12:00:00 - Mike - 2 - Afternoon  
10/1/2013 - 12:03:00 - Mike - 1 - Afternoon  
...  
... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But lots and lots of them, with tons of UserNames.  The When field is always one of three values.  &lt;/P&gt;

&lt;P&gt;I then run a search:&lt;BR /&gt;&lt;BR /&gt;
... | chart sum(BytesSent) over UserName by When&lt;/P&gt;

&lt;P&gt;To take all these logs, sum the BytesSent based on the UserName and When fields.  Giving me a chart like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        Morning   Afternoon Evening
    Mike    1         7          3
    Steve   4         3          8
    Sue     6         5          6
    Bob     2         1          1
    Sara    3         0          2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to filter these results.  For example, I only want to show users who sent more in the evening than the afternoon.  So looking for this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        Morning   Afternoon Evening
    Steve   4         3          8
    Sue     6         5          6
    Sara    3         0          2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Some other ideas.... &lt;/P&gt;

&lt;P&gt;I have tried using eventstats to sum the fields and add the total to each log:&lt;BR /&gt;&lt;BR /&gt;
... | eventstats sum(BytesSend) as Total by UserName, When&lt;/P&gt;

&lt;P&gt;At this point I dont need all the logs anymore because the information I need is included in each one. So I can dedup:&lt;BR /&gt;&lt;BR /&gt;
... | dedup UserName When&lt;/P&gt;

&lt;P&gt;Now what....?  Use transaction to create multi value fields....?&lt;BR /&gt;&lt;BR /&gt;
.. | transaction UserName&lt;/P&gt;

&lt;P&gt;The problem is the order of the multi value fields is not consistent.  mvindex(Total,0) is not the same in each transaction.  It can be any of the three values, Morning, Afternoon, or Evening.  If it was consistent, we would be done.  I could ultimately use table to display the results and throw a | where at the end to do the filtering.&lt;/P&gt;

&lt;P&gt;... | table UserName Morning_Total Afternoon_Total Evening_Total | where Evening_Total&amp;gt;Afternoon_Total&lt;/P&gt;

&lt;P&gt;I guess there is some way I could use eval and if statements to get the values into the right places, but I seem to run into problems with this also.  &lt;/P&gt;

&lt;P&gt;My point is.... there has to be a simpler way..... &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:57:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95432#M24630</guid>
      <dc:creator>JWBailey</dc:creator>
      <dc:date>2020-09-28T14:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: filter results inside a chart...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95433#M24631</link>
      <description>&lt;P&gt;I think you should add actual examples - makes it much easier to help out. Events, searches you're using, etc.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 22:01:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95433#M24631</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-10-11T22:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: filter results inside a chart...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95434#M24632</link>
      <description>&lt;P&gt;I could be missing the point entirely, but for a results table like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Morning   Afternoon Evening
Mike    1         7          3
Steve   4         3          8
Sue     6         5          6
Bob     2         1          1
Sara    3         0          2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To filter this result to only those who sent more in the Evening than Morning wouldn't it be just&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where (Evening &amp;gt; Morning)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Surely this can't be it?&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2013 19:35:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95434#M24632</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2013-10-13T19:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: filter results inside a chart...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95435#M24633</link>
      <description>&lt;P&gt;"Morning" "Afternoon" and "Evening" are the values in the When field.  Evening &amp;gt; Morning is not valid.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2013 22:36:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95435#M24633</guid>
      <dc:creator>JWBailey</dc:creator>
      <dc:date>2013-10-13T22:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: filter results inside a chart...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95436#M24634</link>
      <description>&lt;P&gt;In your example -- which I copypasted from the question above -- they are not.  "Morning", "Afternoon", and "Evening" are field names.  "3" is the value of "Evening" for "Mike".  Are your examples representative of your data or not?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2013 01:18:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95436#M24634</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2013-10-14T01:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: filter results inside a chart...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95437#M24635</link>
      <description>&lt;P&gt;The primary point being that you can do a &lt;CODE&gt;where&lt;/CODE&gt; to filter &lt;STRONG&gt;after&lt;/STRONG&gt; running chart.  By telling chart to split-by &lt;CODE&gt;When&lt;/CODE&gt;, that makes each value of &lt;CODE&gt;When&lt;/CODE&gt; a new field in the results table -- and therefore something you can directly compare against.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2013 01:21:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95437#M24635</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2013-10-14T01:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: filter results inside a chart...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95438#M24636</link>
      <description>&lt;P&gt;Yes, a simple | where does it, see, I knew it had to be easier... &lt;/P&gt;

&lt;P&gt;My problem was:  When you use chart and the by clause to control the X axis, it lists the columns in alphabetical order, since my fields represent time frames, I actually used "1_Morning" "2_Afternoon" and "3_Evening" as the field names to get them in the order I wanted.  Apparently having the number in the fieldname does something it doesnt like.  As soon as I remove them, the | where command works.  &lt;/P&gt;

&lt;P&gt;I will just pipe to a table to display in the order I want instead of changing the field names.  &lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:57:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-results-inside-a-chart/m-p/95438#M24636</guid>
      <dc:creator>JWBailey</dc:creator>
      <dc:date>2020-09-28T14:57:38Z</dc:date>
    </item>
  </channel>
</rss>

