<?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 can I write the following to get past the join limitation? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602009#M209530</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/210706"&gt;@sb01splunk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;join is a very slow command with the limit of 50,000 results in the subsearch, so I hint to see this approach using stats command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aws (eventName=TerminateInstances OR (source="us-west-1:ec2_instances" sourcetype="aws:description"))
| eval status=if(eventName=TerminateInstances,"1","2"), 
 vm_id=coalesce(vm_id,"requestParameters.instancesSet.items{}.instanceId")
| stats 
   dc(status) AS dc_status 
   values(status) AS status 
   earliest(_time) AS _time 
   values(action) AS action 
   values(tags.Name) AS tags.Name 
   values(userNa) AS userNa 
   BY vm_id
| where dc_status=1 AND status="1"
| table _time action vm_id tags.Name userName&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 06:25:42 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-06-16T06:25:42Z</dc:date>
    <item>
      <title>How can I write the following to get past the join limitation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/601986#M209520</link>
      <description>&lt;P&gt;How can I write the following to get past the join limitation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=aws eventName=TerminateInstances
| Rename "requestParameters.instancesSet.items{}.instanceId" AS vm_id
| join vm_id type=left max=0
[ search index=aws source="us-west-1:ec2_instances" sourcetype="aws:description" ]
| dedup vm_id
| table _time, action, vm_id, tags.Name, userName&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 23:32:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/601986#M209520</guid>
      <dc:creator>sb01splunk</dc:creator>
      <dc:date>2022-06-15T23:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I write the following to get past the join limitation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602008#M209529</link>
      <description>&lt;P&gt;Depending on how many events you have in the first search, you could try swapping them.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aws source="us-west-1:ec2_instances" sourcetype="aws:description" 
| join vm_id type=left max=0
[ search index=aws eventName=TerminateInstances
| rename "requestParameters.instancesSet.items{}.instanceId" AS vm_id ]
| dedup vm_id
| table _time, action, vm_id, tags.Name, userName&lt;/LI-CODE&gt;&lt;P&gt;Or, you could try using stats to do the join, something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aws (eventName=TerminateInstances OR source="us-west-1:ec2_instances" sourcetype="aws:description")
| rename "requestParameters.instancesSet.items{}.instanceId" AS vm_id
| eval _event_time=if(eventNaame="TerminateInstances", _time, null())
| stats values(_event_time) as _event_time, values(_event_time) as _event_time, values(action) as action, values('tags.Name') as tags.Name, values(userName) as userName by vm_id
| eval _time=coalesce(_event_time,_time)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 06:25:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602008#M209529</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-16T06:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I write the following to get past the join limitation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602009#M209530</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/210706"&gt;@sb01splunk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;join is a very slow command with the limit of 50,000 results in the subsearch, so I hint to see this approach using stats command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aws (eventName=TerminateInstances OR (source="us-west-1:ec2_instances" sourcetype="aws:description"))
| eval status=if(eventName=TerminateInstances,"1","2"), 
 vm_id=coalesce(vm_id,"requestParameters.instancesSet.items{}.instanceId")
| stats 
   dc(status) AS dc_status 
   values(status) AS status 
   earliest(_time) AS _time 
   values(action) AS action 
   values(tags.Name) AS tags.Name 
   values(userNa) AS userNa 
   BY vm_id
| where dc_status=1 AND status="1"
| table _time action vm_id tags.Name userName&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 06:25:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602009#M209530</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-16T06:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I write the following to get past the join limitation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602081#M209565</link>
      <description>&lt;P&gt;Thanks for getting me in the right direction.&amp;nbsp; The following seems to work&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=aws sourcetype="aws:cloudtrail" eventName=TerminateInstances) OR (index=aws source="us-west-1:ec2_instances" sourcetype="aws:description")
| eval joiner=if(sourcetype="aws:cloudtrail", 'requestParameters.instancesSet.items{}.instanceId', vm_id)
| eval Time=if(eventName="TerminateInstances", _time, null())
| eval Time=strftime(Time, "%Y-%d-%m %H:%M:%S")
| stats values(*) as * by joiner
| where 'requestParameters.instancesSet.items{}.instanceId'=vm_id
| table Time, userName, action, vm_id, "tags.Name"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;if I try something like this though it returns nothing&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=aws sourcetype="aws:cloudtrail" eventName=TerminateInstances) OR (index=aws source="us-west-1:ec2_instances" sourcetype="aws:description")
| eval joiner=if(sourcetype="aws:cloudtrail", 'requestParameters.instancesSet.items{}.instanceId', vm_id)
| eval Time=if(eventName="TerminateInstances", _time, null())
| eval Time=strftime(Time, "%Y-%d-%m %H:%M:%S")
| stats values(Time) as Time, values(userName) as userName, values(action) as action, values(vm_id) as vm_id, values('tags.Name') as tags.Name by joiner
| where 'requestParameters.instancesSet.items{}.instanceId'=vm_id
| table Time, userName, action, vm_id, "tags.Name"&lt;/LI-CODE&gt;&lt;P&gt;I'm curious why the 2nd one returns nothing.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 13:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602081#M209565</guid>
      <dc:creator>sb01splunk</dc:creator>
      <dc:date>2022-06-16T13:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I write the following to get past the join limitation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602090#M209571</link>
      <description>&lt;P&gt;requestParameters.instancesSet.items{}.instanceId isn't included in the stats command in the second version so is not available for the where command&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 13:58:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-write-the-following-to-get-past-the-join-limitation/m-p/602090#M209571</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-16T13:58:54Z</dc:date>
    </item>
  </channel>
</rss>

