<?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 How to join or corelate 3 different index/sourcetypes in single query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/682222#M233075</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have requirement as below, please could you review and suggest ?&lt;/P&gt;&lt;P&gt;Need to pick up all client ids from application log called &lt;U&gt;&lt;STRONG&gt;"Cos"&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;(index=a sourcetype=Cos ) where distinct client ids are in 6Millions. And, I want to compare whether these clients ids are present in&amp;nbsp; another application log called &lt;STRONG&gt;"Ma"&lt;/STRONG&gt;&amp;nbsp;(index=a sourcetype=Ma).&lt;/P&gt;&lt;P&gt;And, I also want to compare the same in another application&amp;nbsp; called &lt;STRONG&gt;"Ph" (&lt;/STRONG&gt;index=a sourcetype=Ph)&lt;/P&gt;&lt;P&gt;Basically trying to get the count/volume based on the client id, which is common among the 3 application (&lt;STRONG&gt;Cos, Ma,Ph&lt;/STRONG&gt;). The total events are in Millions and when i use join, the search job is getting auto-cancelled or getting terminated.&lt;/P&gt;&lt;P&gt;(index=a sourcetype=Cos) OR (index=a sourcetype=Ma) OR (index=a sourcetype=Ph) stats count by clientid, sourcetype&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Selvam.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Mar 2024 03:41:22 GMT</pubDate>
    <dc:creator>selvam_sekar</dc:creator>
    <dc:date>2024-03-28T03:41:22Z</dc:date>
    <item>
      <title>How to join or corelate 3 different index/sourcetypes in single query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/682222#M233075</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have requirement as below, please could you review and suggest ?&lt;/P&gt;&lt;P&gt;Need to pick up all client ids from application log called &lt;U&gt;&lt;STRONG&gt;"Cos"&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;(index=a sourcetype=Cos ) where distinct client ids are in 6Millions. And, I want to compare whether these clients ids are present in&amp;nbsp; another application log called &lt;STRONG&gt;"Ma"&lt;/STRONG&gt;&amp;nbsp;(index=a sourcetype=Ma).&lt;/P&gt;&lt;P&gt;And, I also want to compare the same in another application&amp;nbsp; called &lt;STRONG&gt;"Ph" (&lt;/STRONG&gt;index=a sourcetype=Ph)&lt;/P&gt;&lt;P&gt;Basically trying to get the count/volume based on the client id, which is common among the 3 application (&lt;STRONG&gt;Cos, Ma,Ph&lt;/STRONG&gt;). The total events are in Millions and when i use join, the search job is getting auto-cancelled or getting terminated.&lt;/P&gt;&lt;P&gt;(index=a sourcetype=Cos) OR (index=a sourcetype=Ma) OR (index=a sourcetype=Ph) stats count by clientid, sourcetype&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Selvam.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 03:41:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/682222#M233075</guid>
      <dc:creator>selvam_sekar</dc:creator>
      <dc:date>2024-03-28T03:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to join or corelate 3 different index/sourcetypes in single query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/682226#M233077</link>
      <description>&lt;P&gt;As you already experience, Splunk strongly disfavors join. &amp;nbsp;This is just natural as most noSQL do.&lt;/P&gt;&lt;P&gt;So, you explained how many events these sources can give, and how many different client ID's. &amp;nbsp;What you forget to tell us is what you mean by "&lt;SPAN&gt;to get the count/volume based on the client id". &amp;nbsp;If you only want to count events from each sourcetype by clientid, all you need to do is&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=a sourcetype=Cos) OR (index=a sourcetype=Ma) OR (index=a sourcetype=Ph)
``` you can also use
index=a sourcetype IN (Cos, Ma, Ph)
```
| stats count by clientid, sourcetype&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;(which is a copy of the SPL snippet but added a pipe (|) in front of stats to make syntax correct.)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;There is no join. &amp;nbsp;The above will not timeout even with millions of event.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In other words, what does "compare" mean in "to compare the same in another application", and what does the word mean in "to compare whether these clients ids are present in&amp;nbsp; another application"?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you want to know which and how many sourcetypes (apps) each clientid appear in, all you need is to add the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats sum(count) as total values(sourcetype) as apps dc(sourcetype) as app_count by clientid&lt;/LI-CODE&gt;&lt;P&gt;Put together,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=a sourcetype=Cos) OR (index=a sourcetype=Ma) OR (index=a sourcetype=Ph)
``` you can also use
index=a sourcetype IN (Cos, Ma, Ph)
```
| stats count by clientid, sourcetype
| stats sum(count) as total values(sourcetype) as apps dc(sourcetype) as app_count by clientid&lt;/LI-CODE&gt;&lt;P&gt;Still no join. &amp;nbsp;Where do you get join to time out?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 04:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/682226#M233077</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-03-28T04:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to join or corelate 3 different index/sourcetypes in single query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/682233#M233079</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/260960"&gt;@selvam_sekar&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;to identify the common clientids between the threee sourcetypes, you should run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=a sourcetype IN ("Cos","Ma","Ph") 
| stats 
   count 
   dc(sourcetype) AS sourcetype_count 
   BY clientid
| where sourcetype_count=3
| fields - sourcetype_count&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 06:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/682233#M233079</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-28T06:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to join or corelate 3 different index/sourcetypes in single query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/684723#M233717</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/260960"&gt;@selvam_sekar&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 21:31:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-or-corelate-3-different-index-sourcetypes-in-single/m-p/684723#M233717</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-04-18T21:31:31Z</dc:date>
    </item>
  </channel>
</rss>

