<?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 construct a table with values being evaluated per number of field values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181705#M52374</link>
    <description>&lt;P&gt;That sounds like a solution indeed, but I got stuck with Splunk 4.3.6 at least till the end of a year, any idea if it can be done without lookup? Maybe hard-coded evals per name?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Oct 2014 19:26:52 GMT</pubDate>
    <dc:creator>giovere</dc:creator>
    <dc:date>2014-10-23T19:26:52Z</dc:date>
    <item>
      <title>How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181697#M52366</link>
      <description>&lt;P&gt;I'm not sure I've used the correct terminolgy to ask a question, so I'll jump into example:&lt;/P&gt;

&lt;P&gt;input:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Name,beers
Bob,6
Anna,7
Bob,4
Anna,3
Anna,9
Bob,10
Bob,11
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to count how many times Bob was below 5 and count how many times Anna was below 8. In this case, desired output looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   Name,Below,Above
   Anna,2,1
   Bob,1,3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In my struggles came up with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search ... | eval Desc=case(beers&amp;lt;=5, "Below", beers&amp;gt;5, "Above")  | chart count over Name by Desc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would have worked, if I had one criteria, but each of the names have its own.&lt;BR /&gt;
Thanks in advance ...&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 14:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181697#M52366</guid>
      <dc:creator>giovere</dc:creator>
      <dc:date>2014-10-23T14:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181698#M52367</link>
      <description>&lt;P&gt;Can you clarify what are the columns names.&lt;BR /&gt;
In your example  we also see that Bob appears several time.&lt;BR /&gt;
Bob,6&lt;BR /&gt;
Bob,4&lt;BR /&gt;
Bob,10&lt;BR /&gt;
Bob,11&lt;/P&gt;

&lt;P&gt;do you want sum all the numbers first ?&lt;BR /&gt;
user=Bob count=31&lt;/P&gt;

&lt;P&gt;then compare count&amp;gt;5 or &amp;lt;8 ?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 14:36:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181698#M52367</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2014-10-23T14:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181699#M52368</link>
      <description>&lt;P&gt;Column names are: Name and beers.&lt;/P&gt;

&lt;P&gt;I'd like first to conut how many entries with Bob have beers &amp;gt;5 (and &amp;lt;=5) and populate table with that count per name.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 14:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181699#M52368</guid>
      <dc:creator>giovere</dc:creator>
      <dc:date>2014-10-23T14:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181700#M52369</link>
      <description>&lt;P&gt;You say each name has its own comparison value, but where does that come from? It's hard to know how to construct a search without knowing where the input comes from?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181700#M52369</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2014-10-23T15:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181701#M52370</link>
      <description>&lt;P&gt;Comparision values (thresholds) are hard-coded, have to be passed through a query. I agree it is sort of ugly, but I do not have any other way to get them in Splunk.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:18:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181701#M52370</guid>
      <dc:creator>giovere</dc:creator>
      <dc:date>2014-10-23T15:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181702#M52371</link>
      <description>&lt;P&gt;Your search looks ok then,it will update the Desc field for each time the condition is met, and you do the chart  count of it&lt;/P&gt;

&lt;P&gt;try this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search ... | eval Desc=case(beers&amp;lt;=5, "Below", beers&amp;gt;5, "Above", 1=1,"other")  | stats count by Name Desc&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search ... | eval Desc=case(beers&amp;lt;=5, "Below", beers&amp;gt;5, "Above", 1=1,"other")  | chart count by Name Desc&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;An alternate method is :&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search ... | eval Above=if(beers&amp;gt;5,1,0)  | eval Below=if(beers&amp;lt;=5,1,0)| stats sum(Above) AS times_Above sum(Below) AS times_Below by Name&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 16:44:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181702#M52371</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2014-10-23T16:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181703#M52372</link>
      <description>&lt;P&gt;Thank you yannK, I'll give it a try tomorrow, but so far I do not understand where would you define condition for Anna and other names?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 18:31:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181703#M52372</guid>
      <dc:creator>giovere</dc:creator>
      <dc:date>2014-10-23T18:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181704#M52373</link>
      <description>&lt;P&gt;I see, you want the conditions to be different &lt;EM&gt;PER NAME&lt;/EM&gt;&lt;BR /&gt;
by example Anna is above after 1 beer, but Bob after 5.&lt;/P&gt;

&lt;P&gt;You need a lookup with those limits in it, one line per name and one columns with the limit value.&lt;BR /&gt;
call it as a lookup to add the detail to each event, then add the eval conditions after using those files instead of static values.&lt;/P&gt;

&lt;P&gt;see lookups. they are simple csv files to upload.&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/Lookup"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/Lookup&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;example of lookup :&lt;BR /&gt;
Name,limit&lt;BR /&gt;
Bob,5&lt;BR /&gt;
Anna,1&lt;/P&gt;

&lt;P&gt;Then after defining it call it&lt;BR /&gt;
&lt;CODE&gt;search ... | lookup mylookup Name | eval Desc=case(beers&amp;lt;=limit, "Below", beers&amp;gt;limit, "Above", 1=1,"other") | stats count by Name Desc&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 19:01:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181704#M52373</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2014-10-23T19:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181705#M52374</link>
      <description>&lt;P&gt;That sounds like a solution indeed, but I got stuck with Splunk 4.3.6 at least till the end of a year, any idea if it can be done without lookup? Maybe hard-coded evals per name?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 19:26:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181705#M52374</guid>
      <dc:creator>giovere</dc:creator>
      <dc:date>2014-10-23T19:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I construct a table with values being evaluated per number of field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181706#M52375</link>
      <description>&lt;P&gt;Probably not the best solution if you have a lot of names, but works Ok with small number of names and Splunk 4.3.*, otherwise with Splunk6 yannK's solution should work fine.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search ... | eval desc=if(match(name,"Bob"),case(beers&amp;lt;=5,"Below",beers&amp;gt;5,"Above"),if(match(name,"Anna"),case(beers&amp;lt;=8,"Below",beers&amp;gt;8,"Above"),"New name")) | stats count(eval(desc="Below")) AS "Below", count(eval(desc="Above")) AS Above by name&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2014 10:54:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-construct-a-table-with-values-being-evaluated-per/m-p/181706#M52375</guid>
      <dc:creator>giovere</dc:creator>
      <dc:date>2014-10-31T10:54:35Z</dc:date>
    </item>
  </channel>
</rss>

