<?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: Lookup table for matching and non matching counts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-for-matching-and-non-matching-counts/m-p/307424#M92232</link>
    <description>&lt;P&gt;Thanks! This was a helpful and straightforward answer. &lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2017 20:16:43 GMT</pubDate>
    <dc:creator>WyldeRhoads</dc:creator>
    <dc:date>2017-05-22T20:16:43Z</dc:date>
    <item>
      <title>Lookup table for matching and non matching counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-for-matching-and-non-matching-counts/m-p/307422#M92230</link>
      <description>&lt;P&gt;I have a lookup table CSV file that has 50 usernames in a single column, and I want to sum the results count of the usernames in the list and the results count of usernames that are not in the list.&lt;/P&gt;

&lt;P&gt;Example CSV column w header:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;username
bob
joe
sue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lets say running a splunk search generates 10 username results and count of logs per username:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo source=barUsers
| stats count by username
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;jan 1&lt;BR /&gt;
sally 2&lt;BR /&gt;
herb 3&lt;BR /&gt;
john 1&lt;BR /&gt;
&lt;STRONG&gt;sue 2&lt;/STRONG&gt;&lt;BR /&gt;
bill 3&lt;BR /&gt;
&lt;STRONG&gt;bob 1&lt;/STRONG&gt;&lt;BR /&gt;
jason 2&lt;BR /&gt;
dan 3&lt;BR /&gt;
kathy 1&lt;/P&gt;

&lt;P&gt;The result I'm looking for would be something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;userMatchCount = 3
nonUserMatchCount = 16
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried things like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo 
| join username
[
| inputlookup usernameList.csv
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But i'm trying to gather the sum of counts on usernames that also do not match the list, using some sort of eval command. &lt;/P&gt;

&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 18:33:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-for-matching-and-non-matching-counts/m-p/307422#M92230</guid>
      <dc:creator>WyldeRhoads</dc:creator>
      <dc:date>2017-05-22T18:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table for matching and non matching counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-for-matching-and-non-matching-counts/m-p/307423#M92231</link>
      <description>&lt;P&gt;On the Search Head, upload the CSV as a &lt;CODE&gt;Lookup file&lt;/CODE&gt; and then create a new &lt;CODE&gt;Lookup table&lt;/CODE&gt; referencing the file name and then do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo source=barUsers
| stats count by username
| lookup username OUTPUT username AS matched
| eval matched=if(isnull(matched), "nonUserMatchCount", "userMatchCount")
| stats sum(count) BY matched
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 May 2017 19:34:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-for-matching-and-non-matching-counts/m-p/307423#M92231</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-22T19:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table for matching and non matching counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-for-matching-and-non-matching-counts/m-p/307424#M92232</link>
      <description>&lt;P&gt;Thanks! This was a helpful and straightforward answer. &lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 20:16:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-for-matching-and-non-matching-counts/m-p/307424#M92232</guid>
      <dc:creator>WyldeRhoads</dc:creator>
      <dc:date>2017-05-22T20:16:43Z</dc:date>
    </item>
  </channel>
</rss>

