<?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: Limiting a query to 'known good' values plus 'others' in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530122#M149781</link>
    <description>&lt;P&gt;If you run the subsearch by itself&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup SenderRecipDomains.csv | return Domain&lt;/LI-CODE&gt;&lt;P&gt;you should get a result like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;((Domain=dept1.org.com) OR (Domain=dept2.org.com) OR ...)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;So the final search becomes&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains" ((Domain=dept1.org.com) OR (Domain=dept2.org.com) OR ...)&lt;/LI-CODE&gt;&lt;P&gt;Which should work fine as long as your exchdomains index has a field called "Domain".&amp;nbsp; If there is no such field then the subsearch needs a &lt;FONT face="courier new,courier"&gt;rename&lt;/FONT&gt; command to make the field name match what's in the index.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Nov 2020 18:31:08 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-11-19T18:31:08Z</dc:date>
    <item>
      <title>Limiting a query to 'known good' values plus 'others'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/529877#M149689</link>
      <description>&lt;P&gt;I have a query similar to the following which we are using to capture information about email traffic between certain (internal) email domains&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains"  | stats count by SenderDomain,recipientDomain 
| xyseries SenderDomain,recipientDomain,count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This builds a nice table, however:&lt;/P&gt;&lt;P&gt;&lt;U&gt;Part 1&lt;/U&gt;&lt;BR /&gt;How do I limit the query to only certain values of 'SenderDomain' and 'recipientDomain' without having to type all the domains (there are about 8 ATM) into the query? Can I use a CSV lookup for this?&lt;/P&gt;&lt;P&gt;&lt;U&gt;Part 2&lt;/U&gt;&lt;BR /&gt;Assuming part one is achievable how do I add a 'catchall' row where I count messages sent from domains NOT in my list of 'SenderDomain' values of interest? And similarly add a 'catchall' column for 'recipientDomain' not in a list of 'known good'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 10:39:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/529877#M149689</guid>
      <dc:creator>gavinsopra</dc:creator>
      <dc:date>2020-11-18T10:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting a query to 'known good' values plus 'others'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/529944#M149708</link>
      <description>&lt;P&gt;To limit a query to values in a lookup file, read the lookup in a subsearch, like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains" [ | inputlookup mylookup.csv | return foo ]
| stats count by SenderDomain,recipientDomain 
| xyseries SenderDomain,recipientDomain,count&lt;/LI-CODE&gt;&lt;P&gt;The above query will read only those events that have the appropriate field values in the CSV so there is no need for a catch-all.&amp;nbsp; An alternative query to create a catch-all might look like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains"  
| lookup mylookup.csv domain as SenderDomain OUTPUT domain as foundSDomain
| lookup mylookup.csv domain as recipientDomain OUTPUT domain as foundRDomain
| fillnull value="unknown" foundSDomain foundRDomain
| stats count by foundSDomain, foundRDomain 
| xyseries foundSDomain,foundRDomain,count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 15:40:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/529944#M149708</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-18T15:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting a query to 'known good' values plus 'others'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530072#M149762</link>
      <description>&lt;P&gt;Richgallowy,&lt;/P&gt;&lt;P&gt;Thanks for the response but I am having some difficulty getting it to work.&lt;/P&gt;&lt;P&gt;I have added a lookup table which returns the following&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup SenderRecipDomains.csv

Domain				DomainName
dept1.org.com		Dept1
dept2.org.com		Dept2
dept3.org.com		Dept3
dept4.org.com		Dept4
dept5.org.com		Dept5
deptA.remote.com	RemoteDeptA
deptB.remote.com	RemoteDeptB
deptC.remote.com	RemoteDeptC&lt;/LI-CODE&gt;&lt;P&gt;If I run the following query with a very tight date/time range I get 47 events&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains"&lt;/LI-CODE&gt;&lt;P&gt;If I run this query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains" [ | inputlookup SenderRecipDomains.csv | return Domain ]&lt;/LI-CODE&gt;&lt;P&gt;or this query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains" [ | inputlookup SenderRecipDomains.csv | fields Domain ]&lt;/LI-CODE&gt;&lt;P&gt;against the same date/time range I get 0 events.&lt;/P&gt;&lt;P&gt;Have I configured the lookup incorrectly?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 12:05:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530072#M149762</guid>
      <dc:creator>gavinsopra</dc:creator>
      <dc:date>2020-11-19T12:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting a query to 'known good' values plus 'others'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530122#M149781</link>
      <description>&lt;P&gt;If you run the subsearch by itself&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup SenderRecipDomains.csv | return Domain&lt;/LI-CODE&gt;&lt;P&gt;you should get a result like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;((Domain=dept1.org.com) OR (Domain=dept2.org.com) OR ...)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;So the final search becomes&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains" ((Domain=dept1.org.com) OR (Domain=dept2.org.com) OR ...)&lt;/LI-CODE&gt;&lt;P&gt;Which should work fine as long as your exchdomains index has a field called "Domain".&amp;nbsp; If there is no such field then the subsearch needs a &lt;FONT face="courier new,courier"&gt;rename&lt;/FONT&gt; command to make the field name match what's in the index.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 18:31:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530122#M149781</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-19T18:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting a query to 'known good' values plus 'others'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530246#M149818</link>
      <description>&lt;P&gt;Curiouser and curiouser.&lt;/P&gt;&lt;P&gt;As stated before this query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup SenderRecipDomains.csv&lt;/LI-CODE&gt;&lt;P&gt;Returns this result&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Domain DomainName
dept1.org.com Dept1
dept2.org.com Dept2
dept3.org.com Dept3
dept4.org.com Dept4
dept5.org.com Dept5
deptA.remote.com RemoteDeptA
deptB.remote.com RemoteDeptB
deptC.remote.com RemoteDeptC
&lt;/LI-CODE&gt;&lt;P&gt;So if I run this query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup SenderRecipDomains.csv | return Domain&lt;/LI-CODE&gt;&lt;P&gt;I get this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Domain="dept1.org.com"&lt;/LI-CODE&gt;&lt;P&gt;However, it appears that 'return' requires a "count" which leads to this query and result&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup SenderRecipDomains.csv | return 2 Domain

(Domain="dept1.org.com") OR (Domain="dept2.org.com")&lt;/LI-CODE&gt;&lt;P&gt;So I am running this to get all the data from my CSV&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup SenderRecipDomains.csv | return 9999 Domain

(Domain="dept1.org.com") OR (Domain="dept2.org.com") OR (Domain="dept3.org.com") OR (Domain="dept4.org.com") OR (Domain="dept5.org.com") OR (Domain="deptA.remote.com") OR (Domain="deptB.remote.com") OR (Domain="deptC.remote.com")&lt;/LI-CODE&gt;&lt;P&gt;Which means that part 1 is now working - many thanks.&lt;/P&gt;&lt;P&gt;I have just started looking at part 2.&lt;/P&gt;&lt;P&gt;I have started with&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="exchdomains"
| inputlookup SenderRecipDomains.csv Domain as SenderDomain OUTPUT Domain as foundSDomain&lt;/LI-CODE&gt;&lt;P&gt;But I get the error "&lt;SPAN&gt;Error in 'inputlookup' command: Invalid argument: 'domain'&lt;/SPAN&gt;"&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 16:39:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530246#M149818</guid>
      <dc:creator>gavinsopra</dc:creator>
      <dc:date>2020-11-20T16:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting a query to 'known good' values plus 'others'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530247#M149819</link>
      <description>&lt;P&gt;My bad.&amp;nbsp; I was using 'inputlookup' when I should have used 'lookup'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 16:42:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530247#M149819</guid>
      <dc:creator>gavinsopra</dc:creator>
      <dc:date>2020-11-20T16:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting a query to 'known good' values plus 'others'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530257#M149820</link>
      <description>&lt;P&gt;If your problem is resolved, then please click the "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 18:17:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Limiting-a-query-to-known-good-values-plus-others/m-p/530257#M149820</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-20T18:17:51Z</dc:date>
    </item>
  </channel>
</rss>

