<?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: Is there a best practice for creating a multivalue field instead of writing a search with a lot of OR statements? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212642#M62306</link>
    <description>&lt;P&gt;Thanks so much for all your help! I am all set now.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2016 18:57:20 GMT</pubDate>
    <dc:creator>pashtet13</dc:creator>
    <dc:date>2016-06-17T18:57:20Z</dc:date>
    <item>
      <title>Is there a best practice for creating a multivalue field instead of writing a search with a lot of OR statements?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212638#M62302</link>
      <description>&lt;P&gt;I need to search through my email logs to determine who sends emails to personal accounts (e.g. gmail, yahoo, etc).&lt;BR /&gt;
Right now my search looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=exchange_logs recipient_domain="yahoo.com" OR recipient_domain="gmail.com" OR recipient_domain="google.com" OR recipient_domain="hotmail.com" OR recipient_domain="hotmail.co.uk" .....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I want to add new personal email domains, I need to edit the search and manually add another "OR" line.&lt;BR /&gt;
I was wondering if I can create a multivalue field that will contain all personal domains and then create a search where &lt;CODE&gt;recipient_domain=*any value from the multivalue field*&lt;/CODE&gt;.&lt;BR /&gt;
This will make my search look much cleaner.&lt;/P&gt;

&lt;P&gt;p.s. I was able to create a multivalue field that looks like this: &lt;CODE&gt;"comcast.net aol.com att.net yahoo.com hotmail.com gmail.com"&lt;/CODE&gt;, but now I don't know how to compare recipient_domain to each value.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 16:32:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212638#M62302</guid>
      <dc:creator>pashtet13</dc:creator>
      <dc:date>2016-06-17T16:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a best practice for creating a multivalue field instead of writing a search with a lot of OR statements?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212639#M62303</link>
      <description>&lt;P&gt;It sounds like you may want to have a CSV lookup table that contains your various domains, and then include the lookup table as a subsearch to your main query.  See this link for a similar problem and how a lookup table was incorporated:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/83846/use-lookup-table-to-specify-hosts-to-search.html"&gt;https://answers.splunk.com/answers/83846/use-lookup-table-to-specify-hosts-to-search.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also, here is info on configuring CSV lookup tables:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/ConfigureCSVlookups"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/ConfigureCSVlookups&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 16:58:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212639#M62303</guid>
      <dc:creator>kbarker302</dc:creator>
      <dc:date>2016-06-17T16:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a best practice for creating a multivalue field instead of writing a search with a lot of OR statements?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212640#M62304</link>
      <description>&lt;P&gt;Thanks for your help. I created a lookup table with the list of domains, then tried this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=exchange_logs eventtype="smtp-outbound" recipient_domain=personal_email_domain | stats count by recipient_domain | sort -count [| inputlookup personal_domains | fields personal_email_domain]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where personal_domains is the name of a lookup csv file and personal_email_domain is a column name in the file that has a list of domain. This search is not returning anything. Is there any syntax error I made?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212640#M62304</guid>
      <dc:creator>pashtet13</dc:creator>
      <dc:date>2020-09-29T09:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a best practice for creating a multivalue field instead of writing a search with a lot of OR statements?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212641#M62305</link>
      <description>&lt;P&gt;If you see the solution in the answers post 83846, the lookup is used in outer search/main search (before first pipe ). Your lookup command should be used there like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=exchange_logs eventtype="smtp-outbound"  [| inputlookup personal_domains | fields personal_email_domain rename | rename personal_email_domain recipient_domain ]| stats count by recipient_domain | sort -count 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jun 2016 18:26:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212641#M62305</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-17T18:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a best practice for creating a multivalue field instead of writing a search with a lot of OR statements?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212642#M62306</link>
      <description>&lt;P&gt;Thanks so much for all your help! I am all set now.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 18:57:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-best-practice-for-creating-a-multivalue-field-instead/m-p/212642#M62306</guid>
      <dc:creator>pashtet13</dc:creator>
      <dc:date>2016-06-17T18:57:20Z</dc:date>
    </item>
  </channel>
</rss>

