<?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: Condition based Joins in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617354#M214558</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Giuseppe,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your quick response but the solution that you provide will not work in my case.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Oct 2022 13:31:54 GMT</pubDate>
    <dc:creator>mnj1809</dc:creator>
    <dc:date>2022-10-17T13:31:54Z</dc:date>
    <item>
      <title>How to execute these condition based Joins?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617343#M214549</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I need your help to find a way to achieve the following use case:&lt;BR /&gt;&lt;BR /&gt;in main search:&lt;BR /&gt;I've to categories: Windows and NIX. both the categories have ip and hostname fields.&lt;BR /&gt;&lt;BR /&gt;category&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hostname&lt;BR /&gt;windows&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x.x.x.x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a&lt;BR /&gt;nix&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;y.y.y.y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b&lt;BR /&gt;&lt;BR /&gt;Now my requirement is to join the above result set with another result set based on the following business rules:&lt;/P&gt;
&lt;P&gt;- for windows, I want to join based on the hostname only.&lt;BR /&gt;- for nix, I want to join&amp;nbsp;&amp;nbsp;based on both ip and hostname.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 14:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617343#M214549</guid>
      <dc:creator>mnj1809</dc:creator>
      <dc:date>2022-10-17T14:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617347#M214552</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/189754"&gt;@mnj1809&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I suppose that you want to join the results in one search, but what are the results after joining?&lt;/P&gt;&lt;P&gt;anuway. if in another index you have ip, hostname and other information (e.g. field1 and field2, you could run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_main_search&amp;gt;
| eval key=if(category="windows",hostname,ip."|".hostname
| append è[ search 
   &amp;lt;your_secondary_search&amp;gt; 
   | eval key=if(category="windows",hostname,ip."|".hostname
   | field key field1 field2 ]
| stats 
   values(hostname) AS hostname
   values(ip) AS ip
   values(field1) AS field1
   values(field2) AS field2
   BY key
| fields - key&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 12:21:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617347#M214552</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-17T12:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617348#M214553</link>
      <description>&lt;P&gt;Firstly, you should try to avoid using join in splunk - splunk is not an SQL database.&lt;/P&gt;&lt;P&gt;Secondly, it depends what your other data source contains and where it is coming from, e.g. another index or lookup file.&lt;/P&gt;&lt;P&gt;Please can you expand on your usecase?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 12:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617348#M214553</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-17T12:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617350#M214555</link>
      <description>&lt;P&gt;Thanks a lot for your prompt response. Yes we should avoid joins to improve the performance. but sometimes we've to use joins. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;The main search has the different data source and the sub search has the different one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;my requirement is to compare two inventories let's say CMDB and Qualys inventories based on IP and hostnames in the CMDB inventory.&lt;/P&gt;&lt;P&gt;index=cmdb&lt;BR /&gt;| stats values(*) as * by category, hostname, ip&lt;BR /&gt;| join type=left hostname&lt;BR /&gt;[search&amp;nbsp; index=qualys&lt;BR /&gt;| stats values(*) as * by hostname]&lt;BR /&gt;| join type=left ip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;[search&amp;nbsp; index=qualys&lt;BR /&gt;| stats values(*) as * by ip]&lt;/P&gt;&lt;P&gt;So my requirement is to join the cmdb hostnames with qualys hostnames only for "windows category" (I don't want to join the cmdb ip with qualys ip).&amp;nbsp;&lt;/P&gt;&lt;P&gt;But for nix category I want to join the cmdb hostnames and ip with both qualys hostnames and ip.&lt;BR /&gt;So as this way I find the assets which are in cmdb and not in qualys.&lt;/P&gt;&lt;P&gt;Hope this will help you to understand my requirement.&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 12:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617350#M214555</guid>
      <dc:creator>mnj1809</dc:creator>
      <dc:date>2022-10-21T12:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617354#M214558</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Giuseppe,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your quick response but the solution that you provide will not work in my case.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 13:31:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617354#M214558</guid>
      <dc:creator>mnj1809</dc:creator>
      <dc:date>2022-10-17T13:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617363#M214560</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/189754"&gt;@mnj1809&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You could also use the way I described to choose the correlation key between the archives, but,&amp;nbsp;as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;said,&amp;nbsp;&lt;SPAN&gt;you should try to avoid using join in splunk - splunk is not an SQL database because it's very slow and requires many resources.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I hint to adapt my approach to your need, instead to use join.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 14:10:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617363#M214560</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-17T14:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617374#M214563</link>
      <description>&lt;P&gt;From the way you are trying to solve the problem, would it be fair to say&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;for windows, the ip address in cmdb may not match ip address in qualys for the same host name&lt;/LI&gt;&lt;LI&gt;for nix, there may be multiple ip addresses for the same host name in both cmdb and qualys&lt;/LI&gt;&lt;LI&gt;qualys doesn't record what the category is&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 17 Oct 2022 15:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617374#M214563</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-17T15:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617380#M214564</link>
      <description>&lt;P&gt;Assuming that points above are true, you might need to change this around if you want to keep the cmdb ip address rather than the qualys ip address&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;``` Copy cmdb field(s) and category to qualys events for nix (host and ip matches) ```
| eventstats values(cmdb_field) as cmdb_field values(category) as category by hostname ip
``` Uncategorised qualys events must be windows ```
| fillnull value="windows" category
``` Create matching key dependent on category ```
| eval hostip=if(category="windows",hostname."|".category,hostname."|".ip)
``` Copy cmdb field(s) to qualys events ```
| eventstats values(cmdb_field) as cmdb_field by hostip
``` Only need to keep qualys events ```
| where index="qualys"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 15:42:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617380#M214564</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-17T15:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Condition based Joins</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617961#M214769</link>
      <description>&lt;P&gt;First of all thanks to @ITWhisperer for the prompt responses but unfortunately the solution that you shared will not work in my use case. I find the solution from my own. What I did is just to take the ip in cmdb as null for windows because we can've multiple ips for windows workstations for the same host so that's why I don't want to use cmdb ip address to join with qualys ip address for windows, only want to use cmdb hostname to join with qualys hostname. But for nix category I want to use both cmdb ip address and hostname to join with qualys ip and hostname.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;```cmdb ip and hostnames```&lt;BR /&gt;| eval ip=if(category="windows",null(),ip)&lt;BR /&gt;| join max=0 type=LEFT host_name&lt;BR /&gt;[```Qualys hostnames```]&lt;BR /&gt;| join max=0 type=left ip&lt;BR /&gt;[```Qualys ip```]&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 11:01:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-execute-these-condition-based-Joins/m-p/617961#M214769</guid>
      <dc:creator>mnj1809</dc:creator>
      <dc:date>2022-10-21T11:01:25Z</dc:date>
    </item>
  </channel>
</rss>

