<?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: Issue with using &amp;quot;search IN&amp;quot; command within map in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670652#M229888</link>
    <description>&lt;P&gt;Thank you for your answer, it helped me out. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;The final version was a bit more trickier as in the &lt;STRONG&gt;ips&lt;/STRONG&gt; field can be an "*" instead of any listed values and in that case any of the found values should be considered.&lt;BR /&gt;So this was the final solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval ips="a,c,x"
```| eval ips="*"```
| eval ips=replace(ips, "\*", "%")
| map [
  | makeresults
  | append [ makeresults | eval ips="a", label="aaa" ]
  | append [ makeresults | eval ips="b", label="bbb" ]
  | append [ makeresults | eval ips="c", label="ccc" ]
  | append [ makeresults | eval ips="d", label="ddd" ]
  | eval outer_ips=split("$ips$", ",")
  | where (ips=outer_ips OR LIKE(ips, "$ips$"))
```with the above conditon when only a * (%) is there as a value it will catch it with the LIKE. when some other value then the first condition will catch the proper events)```
] maxsearches=10&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2023 15:09:28 GMT</pubDate>
    <dc:creator>Kristian_86</dc:creator>
    <dc:date>2023-12-04T15:09:28Z</dc:date>
    <item>
      <title>Issue with using "search IN" command within map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670377#M229816</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have the following issue, do you know any solution or workaround?&lt;BR /&gt;(Or maybe I declared something wrongly...)&lt;BR /&gt;When using a comma separated field values in &lt;STRONG&gt;MAP&lt;/STRONG&gt; within the &lt;STRONG&gt;IN&lt;/STRONG&gt; command, it is not working from the outer search. But when I write out the value of that outside field, it is recognized.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval ips="a,c,x"
| map [
  | makeresults
  | append [ makeresults | eval ips="a", label="aaa" ]
  | append [ makeresults | eval ips="b", label="bbb" ]
  | append [ makeresults | eval ips="c", label="ccc" ]
  | append [ makeresults | eval ips="d", label="ddd" ]
  ```| search ips IN ($ips$)```           ```NOT WORKING```
  | search ips IN (a,c,x)           ```WORKING```
  | eval outer_ips=$ips$
] maxsearches=10&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 17:35:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670377#M229816</guid>
      <dc:creator>Kristian_86</dc:creator>
      <dc:date>2023-11-30T17:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with using "search IN" command within map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670401#M229821</link>
      <description>&lt;P&gt;Most likely because the substitution is passing $ips$ as the string "a,c,x" and if you search for&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| search ips IN ("a,c,x")&lt;/LI-CODE&gt;&lt;P&gt;you also get no results&lt;/P&gt;&lt;P&gt;You could do it differently using where, for example this works&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval outer_ips=split($ips$, ",")
| where ips=outer_ips&lt;/LI-CODE&gt;&lt;P&gt;or this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where match($ips$, ips)&lt;/LI-CODE&gt;&lt;P&gt;assuming your use case is IP addresses, the where option also allows for cirdmatch if that is useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 22:05:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670401#M229821</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-11-30T22:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with using "search IN" command within map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670652#M229888</link>
      <description>&lt;P&gt;Thank you for your answer, it helped me out. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;The final version was a bit more trickier as in the &lt;STRONG&gt;ips&lt;/STRONG&gt; field can be an "*" instead of any listed values and in that case any of the found values should be considered.&lt;BR /&gt;So this was the final solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval ips="a,c,x"
```| eval ips="*"```
| eval ips=replace(ips, "\*", "%")
| map [
  | makeresults
  | append [ makeresults | eval ips="a", label="aaa" ]
  | append [ makeresults | eval ips="b", label="bbb" ]
  | append [ makeresults | eval ips="c", label="ccc" ]
  | append [ makeresults | eval ips="d", label="ddd" ]
  | eval outer_ips=split("$ips$", ",")
  | where (ips=outer_ips OR LIKE(ips, "$ips$"))
```with the above conditon when only a * (%) is there as a value it will catch it with the LIKE. when some other value then the first condition will catch the proper events)```
] maxsearches=10&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 15:09:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670652#M229888</guid>
      <dc:creator>Kristian_86</dc:creator>
      <dc:date>2023-12-04T15:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with using "search IN" command within map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670714#M229902</link>
      <description>&lt;P&gt;Just as an aside on the use of map, note that it is not a practical command for use on large datasets, as each map result gets executed in its own serial search, so it can take time and depending on the search can cause a lot of overhead to iterate through large result sets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Often there is an alternative way to write the search (but not always). Depends on the use case.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 21:38:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-with-using-quot-search-IN-quot-command-within-map/m-p/670714#M229902</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-12-04T21:38:01Z</dc:date>
    </item>
  </channel>
</rss>

