<?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 to use IN function with VALUE-LIST as a search or lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-IN-function-with-VALUE-LIST-as-a-search-or-lookup/m-p/412418#M172762</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...  | where [search myListSearch
             | fields serverlist
             | makemv delim=":" serverlist
             | mvexpand serverlist
             | rename serverlist AS servername]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 10 Mar 2019 04:07:35 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-03-10T04:07:35Z</dc:date>
    <item>
      <title>How to use IN function with VALUE-LIST as a search or lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-IN-function-with-VALUE-LIST-as-a-search-or-lookup/m-p/412416#M172760</link>
      <description>&lt;P&gt;hi,&lt;BR /&gt;
We have a SPL which emits hostname as a single value, but this needs to be checked against a valid list of hostnames on every line. The list is "colon separated"&lt;/P&gt;

&lt;P&gt;So ideally, we need to check if &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;server01
server02
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is present in &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;List1,server101:server102:server103
List2,server04:server02:server05
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So in above example, the List2 and server02 should have a match. Please note, the List is a search itself. &lt;BR /&gt;
Ideally looking for something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where IN (servername, [|search myListSearch| fields serverlist|split(serverlist,":")])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any way to do this using IN operator? ideally i wanted to check if  &lt;CODE&gt;server01 or server02&lt;/CODE&gt; is present IN the &lt;EM&gt;lists&lt;/EM&gt; in an efficient and short way (rather than splitting the list and comparing). Ideally a "grep -w" should be sufficient&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 11:30:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-IN-function-with-VALUE-LIST-as-a-search-or-lookup/m-p/412416#M172760</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-03-01T11:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use IN function with VALUE-LIST as a search or lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-IN-function-with-VALUE-LIST-as-a-search-or-lookup/m-p/412417#M172761</link>
      <description>&lt;P&gt;You could probably accomplish this with a "normal" subsearch, but I think this works if you want to use the IN function.  I'm just reformatting your server list so it looks like "server01","server02", xxx  since that's what the function expects.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | where IN (servername, [
           |search myListSearch
           | fields serverlist
           |eval serverlist = "\"" . replace(serverlist,":","\",\"") . "\""
           | return serverlist 
          ]
      )
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Mar 2019 03:19:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-IN-function-with-VALUE-LIST-as-a-search-or-lookup/m-p/412417#M172761</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2019-03-10T03:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use IN function with VALUE-LIST as a search or lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-IN-function-with-VALUE-LIST-as-a-search-or-lookup/m-p/412418#M172762</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...  | where [search myListSearch
             | fields serverlist
             | makemv delim=":" serverlist
             | mvexpand serverlist
             | rename serverlist AS servername]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Mar 2019 04:07:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-IN-function-with-VALUE-LIST-as-a-search-or-lookup/m-p/412418#M172762</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-10T04:07:35Z</dc:date>
    </item>
  </channel>
</rss>

