<?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 search from another index in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657878#M227237</link>
    <description>&lt;P&gt;Please explain what you mean by "it doesn't fully work"?&amp;nbsp; How does it fall short?&lt;/P&gt;&lt;P&gt;What exactly are you trying to do with the coalesce function?&lt;/P&gt;&lt;P&gt;Rather than ask how to use specific commands, I suggest you explain your inputs and desired outputs.&amp;nbsp; Then someone can recommend a query.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2023 12:12:26 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-09-18T12:12:26Z</dc:date>
    <item>
      <title>Lookup search from another index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657821#M227210</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bimatomsoc_0-1694965443493.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27220i2FCC858658D5CDBB/image-size/large?v=v2&amp;amp;px=999" role="button" title="bimatomsoc_0-1694965443493.png" alt="bimatomsoc_0-1694965443493.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There are some values of IP addresses from `cim_Authentication_indexes`.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bimatomsoc_1-1694965898513.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27221iF83DEC886EAF6EE4/image-size/large?v=v2&amp;amp;px=999" role="button" title="bimatomsoc_1-1694965898513.png" alt="bimatomsoc_1-1694965898513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This index is for look up.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;I want to make if the IP addresses from `cim_Authentication_indexes` are in the second lookup index.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;I tried making some query but it quite something wrong.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;(`cim_Authentication_indexes`) tag=authentication NOT (action=success user=*$)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| table dest, dst, Ip, source_ip, src_ip, src&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval IP_Addr = coalesce(dest, dst, Ip, source_ip, src_ip, src)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| append [search index="tml_it-mandiant_ti" type=ipv4 | table value]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| stats count by IP_Addr, value&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| where count &amp;gt;= 1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Please correct this and help me out. Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 16:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657821#M227210</guid>
      <dc:creator>bimatomsoc</dc:creator>
      <dc:date>2023-09-17T16:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup search from another index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657824#M227211</link>
      <description>&lt;P&gt;If I understand the use case, you can achieve the goal using a subsearch.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(`cim_Authentication_indexes`) tag=authentication NOT (action=success user=*$)
| table dest, dst, Ip, source_ip, src_ip, src
| eval IP_Addr = coalesce(dest, dst, Ip, source_ip, src_ip, src)
| search [search index="tml_it-mandiant_ti" type=ipv4 | return 10000 IP_Addr=value]
| stats count by IP_Addr
| where count &amp;gt;= 1&lt;/LI-CODE&gt;&lt;P&gt;The subsearch will return a list of up 10,000 IP addresses in the form (IP_Addr=1.2.3.4 OR IP_Addr = 2.3.4.5 OR ...) which the &lt;FONT face="courier new,courier"&gt;search&lt;/FONT&gt; command will use to filter results from cim_Authentication_indexes.&amp;nbsp; The key thing is make sure the field name returned from the subsearch exists in the data from the main search (in the example, IP_Addr rather than value).&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 18:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657824#M227211</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-17T18:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup search from another index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657825#M227212</link>
      <description>&lt;P&gt;Thank you for your quick response. Your query makes sense for me.&lt;BR /&gt;But, it doesn't fully work. I think we should change the whole search. The function I used "coalesce" collects the first field value. If the dest value is not null, it only collects the dest, not collecting the rest of the values like src, src_ip.&lt;BR /&gt;As far as I researched, I think I should use lookup and OUTPUT function to matches all the IPs(src, dest,..) with lookup index's IPs.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 18:41:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657825#M227212</guid>
      <dc:creator>bimatomsoc</dc:creator>
      <dc:date>2023-09-17T18:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup search from another index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657830#M227215</link>
      <description>&lt;P&gt;You can't use lookup on an index, only a lookup table.&lt;/P&gt;&lt;P&gt;I think this should work and won't have the limitations of the subsearch&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;((`cim_Authentication_indexes`) tag=authentication NOT (action=success user=*$))
OR (index="tml_it-mandiant_ti" type=ipv4)
| eval origin=if(index="tml_it-mandiant_ti", "mandiant", "auth")
| eval IP_Addr = coalesce(value, dest, dst, Ip, source_ip, src_ip, src)
| stats dc(origin) as origins by IP_Addr
| where origins=2&lt;/LI-CODE&gt;&lt;P&gt;so, it sets a new field 'origin' to be where the IP address is coming from and if the event is from the tml_it-mandiant_ti index., IP_Addr will be the value, otherwise it will be the other IP address from your original coalesce.&lt;/P&gt;&lt;P&gt;Then just stats and count the number of origins you find. You need it to be 2, indicating the IP address is in both indexes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 23:59:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657830#M227215</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-17T23:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup search from another index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657878#M227237</link>
      <description>&lt;P&gt;Please explain what you mean by "it doesn't fully work"?&amp;nbsp; How does it fall short?&lt;/P&gt;&lt;P&gt;What exactly are you trying to do with the coalesce function?&lt;/P&gt;&lt;P&gt;Rather than ask how to use specific commands, I suggest you explain your inputs and desired outputs.&amp;nbsp; Then someone can recommend a query.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 12:12:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-search-from-another-index/m-p/657878#M227237</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-18T12:12:26Z</dc:date>
    </item>
  </channel>
</rss>

