<?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: Splunk dynamic count of lookups in CSV in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227993#M67348</link>
    <description>&lt;P&gt;Accepted. Sprichst Du Deutsch? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 19 Jan 2016 09:50:39 GMT</pubDate>
    <dc:creator>digitalX</dc:creator>
    <dc:date>2016-01-19T09:50:39Z</dc:date>
    <item>
      <title>Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227987#M67342</link>
      <description>&lt;P&gt;We have the following situation / problem:&lt;BR /&gt;
Some searches having some lookups on CSV files.&lt;BR /&gt;
Now we wont that we never have to touch the Searches again, just edit the CSV.&lt;BR /&gt;
But we need to be able to add some more lines/ Valueboarders to de CSV.&lt;/P&gt;

&lt;P&gt;Example:  in the CSV ist Search 1, Value 50, Score 2&lt;BR /&gt;
Now search 1 knows that values over 50 have the score 2&lt;BR /&gt;
Now we add a additional line: Search 1, Value 100, Score 3&lt;BR /&gt;
Now, search 1 should know that values over 50 have score 2 but over 100 the score is 3.&lt;/P&gt;

&lt;P&gt;My primary question is: Is this the way to go to solve this problem?&lt;BR /&gt;
And if Yes, how can I write the search to heandle this Need and be prepaired for more borders?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jan 2016 22:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227987#M67342</guid>
      <dc:creator>digitalX</dc:creator>
      <dc:date>2016-01-17T22:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227988#M67343</link>
      <description>&lt;P&gt;Hi digitalX,&lt;/P&gt;

&lt;P&gt;If I understand your request correct, you are after setting threshold in a lookup table. This can be achieved by using the &lt;CODE&gt;match_type&lt;/CODE&gt; in &lt;CODE&gt;transforms.conf&lt;/CODE&gt; to specify the field you want to match on as a wildcard, then populate your lookup table just like you've planned to.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;transforms.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[score]
filename = score.csv
match_type = WILDCARD(value)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And your &lt;CODE&gt;score.csv&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mySearch,value,score
foo,5*,2
foo,10*,3
boo,30*,5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you now use this run everywhere command you can get back the score based on the fake count which was made by the first &lt;CODE&gt;eval&lt;/CODE&gt; command:&lt;BR /&gt;
Count is &lt;CODE&gt;101&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | gentimes start=-1 | eval count="101" | eval mySearch="foo" | lookup score value AS count mySearch AS mySearch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the results will look like this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/955iC16FDC56953F5AEC/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Count is &lt;CODE&gt;55&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval count="55" | eval mySearch="foo" | lookup score value AS count mySearch AS mySearch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the result will look like this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/956i3954BBDE16E9112E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Bear in mind, this has some limits. Because the wild card match for &lt;CODE&gt;10*&lt;/CODE&gt; will work from 100 until 109, but also matches 1000 and/or 10000 for example! &lt;/P&gt;

&lt;P&gt;Nevertheless I hope this helps and Grüess nach Chur &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update after the comments:&lt;/STRONG&gt;&lt;BR /&gt;
Use this as &lt;CODE&gt;score.csv&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Search,lower,upper,score
 foo,50,99,2
 foo,100,999,3
 foo,1000,9999,5
 boo,50,99,20
 boo,100,999,30
 boo,1000,9999,50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and use it with &lt;CODE&gt;inputlookup&lt;/CODE&gt; instead of &lt;CODE&gt;lookup&lt;/CODE&gt; in the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval count="999" | eval mySearch="foo" | append [|inputlookup score ] | filldown count mySearch | where mySearch=Search AND count&amp;gt;=lower AND count&amp;lt;=upper
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should do what you need.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2016 01:32:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227988#M67343</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-01-18T01:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227989#M67344</link>
      <description>&lt;P&gt;Thank you for your very fast reply. Good idea, I think I learn every day a Little more about Splunk. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
But in my case this way have to many maybes to mach every constellation correctly.&lt;BR /&gt;
What if we need the boaders 10, 100, 1000, 1010,... or something other with similar values? &lt;BR /&gt;
And it has to match for every value between the two borders, not just for the fist 9... &lt;BR /&gt;
Perhaps there is another technique to achieve this?&lt;BR /&gt;
Greetings back to Wellington &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2016 12:31:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227989#M67344</guid>
      <dc:creator>digitalX</dc:creator>
      <dc:date>2016-01-18T12:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227990#M67345</link>
      <description>&lt;P&gt;Since I like challenging tasks here is the solution &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;change the lookup file to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Search,lower,upper,score
foo,50,99,2
foo,100,999,3
foo,1000,9999,5
boo,50,99,20
boo,100,999,30
boo,1000,9999,50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and use it with &lt;CODE&gt;inputlookup&lt;/CODE&gt; instead of &lt;CODE&gt;lookup&lt;/CODE&gt; in the search:&lt;/P&gt;

&lt;P&gt;| gentimes start=-1 | eval count="999" | eval mySearch="foo" | append [|inputlookup score ] | filldown count mySearch | where mySearch=Search AND count&amp;gt;=lower AND count&amp;lt;=upper | table Search count score&lt;BR /&gt;
This should do what you need.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2016 20:15:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227990#M67345</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-01-18T20:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227991#M67346</link>
      <description>&lt;P&gt;Yes, this is the way to go! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
Thank you so much. Now, when I read it, it sounds logical, but havent seen the clou before... &lt;BR /&gt;
But how can I mark your second answer as accepted? Just see this option for the main answer.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 08:22:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227991#M67346</guid>
      <dc:creator>digitalX</dc:creator>
      <dc:date>2016-01-19T08:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227992#M67347</link>
      <description>&lt;P&gt;Updated the answer, feel free to accept it now - Danke &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 09:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227992#M67347</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-01-19T09:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227993#M67348</link>
      <description>&lt;P&gt;Accepted. Sprichst Du Deutsch? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 09:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227993#M67348</guid>
      <dc:creator>digitalX</dc:creator>
      <dc:date>2016-01-19T09:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk dynamic count of lookups in CSV</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227994#M67349</link>
      <description>&lt;P&gt;Hi MuS,&lt;/P&gt;

&lt;P&gt;I am curious how to use your search when deal with records ? Gentimes only feth you single record.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 03:47:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-dynamic-count-of-lookups-in-CSV/m-p/227994#M67349</guid>
      <dc:creator>genzoeri</dc:creator>
      <dc:date>2016-06-24T03:47:19Z</dc:date>
    </item>
  </channel>
</rss>

