<?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: Join two indexes based on substring match in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527048#M148769</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I just saw below error in Job button dropdown&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;stats' command: limit for values of field 'nip' reached. Some values may have been truncated or ignored.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Oct 2020 10:00:49 GMT</pubDate>
    <dc:creator>ved08514</dc:creator>
    <dc:date>2020-10-29T10:00:49Z</dc:date>
    <item>
      <title>Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526626#M148645</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am struggling with joining two indexes based on substring match.&lt;BR /&gt;&lt;BR /&gt;I have following indexes :&lt;/P&gt;&lt;P&gt;index1 :&lt;BR /&gt;having following fields&lt;/P&gt;&lt;P&gt;PROTOCOL,DIRECTION,FILENAME,DIRECTORYNAME&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index2:&lt;/P&gt;&lt;P&gt;having following fields&lt;BR /&gt;APPID,CUSTOMERID,FILEPATTERN,DIRECTORYNAME&lt;BR /&gt;&lt;BR /&gt;I want to join above indexes based on following condition&amp;nbsp;&lt;BR /&gt;1. FILEPATTERN is substring of FILENAME&lt;/P&gt;&lt;P&gt;2. DIRECTORYNAME in index1 = DIRECTORYNAME in index 2.&lt;/P&gt;&lt;P&gt;and display output with following fields&lt;BR /&gt;PROTOCOL,DIRECTION,APPID,CUSTOMERID,FILEPATTERN,DIRECTORYNAME&lt;/P&gt;&lt;P&gt;Thanks in anticipation&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nikhil&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526626#M148645</guid>
      <dc:creator>ved08514</dc:creator>
      <dc:date>2020-10-27T11:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526628#M148646</link>
      <description>&lt;P&gt;Are there any fields or combination of fields which are unique within each index and/or across both?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:26:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526628#M148646</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-27T11:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526631#M148647</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;FILEPATTERN&amp;nbsp; and&amp;nbsp;DIRECTORYNAME&amp;nbsp; combination in index2 is unique (i.e. its like composite key for index2).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whereas for index1 there are no unique combination.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:37:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526631#M148647</guid>
      <dc:creator>ved08514</dc:creator>
      <dc:date>2020-10-27T11:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526641#M148648</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228139"&gt;@ved08514&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a run anywhere example which hopefully you can adapt for your needs:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval events="app=123,cust=abc,pattern=xyz,dir=abc
app=456,cust=abc,pattern=rst,dir=abc
app=123,cust=def,pattern=xyz,dir=def
app=456,cust=def,pattern=rst,dir=def
prot=ghi,io=in,name=wxyz,dir=abc
prot=ghi,io=in,name=wxyz,dir=abc
prot=ghi,io=out,name=wxyz,dir=abc
prot=ghi,io=out,name=wxyz,dir=abc
prot=jkl,io=in,name=wxyz,dir=abc
prot=jkl,io=in,name=wxyz,dir=abc
prot=jkl,io=out,name=wxyz,dir=abc
prot=jkl,io=out,name=wxyz,dir=abc
prot=ghi,io=in,name=rstu,dir=abc
prot=ghi,io=in,name=rstu,dir=abc
prot=ghi,io=out,name=rstu,dir=abc
prot=ghi,io=out,name=rstu,dir=abc
prot=jkl,io=in,name=rstu,dir=abc
prot=jkl,io=in,name=rstu,dir=abc
prot=jkl,io=out,name=rstu,dir=abc
prot=jkl,io=out,name=rstu,dir=abc"
| rex field=events max_match=0 "(?&amp;lt;event&amp;gt;.*)[\r\n]*" 
| mvexpand event
| eval _raw=event
| fields - _time events
| extract
| rename COMMENT as "made some run anywhere data"

| rename COMMENT as "concatenate fields from different indexes"
| eval nip=name.",".io.",".prot
| eval acp=app.",".cust.",".pattern
| rename COMMENT as "list data from both indexes by directory"
| stats list(acp) as acp list(nip) as nip by dir
| rename COMMENT as "expand data from second index"
| mvexpand acp
| rename COMMENT as "extract original fields"
| rex field=acp "(?&amp;lt;app&amp;gt;[^,]+),(?&amp;lt;cust&amp;gt;[^,]+),(?&amp;lt;pattern&amp;gt;[^,]+)"
| fields - acp
| rename COMMENT as "copy data from first index"
| eval match=nip
| rename COMMENT as "determine if name matches pattern"
| eval match=mvmap(match,if(match(mvindex(split(match,","),0),pattern),1,0))
| rename COMMENT as "zip match result with first index data"
| eval nipmatch=mvzip(match,nip)
| rename COMMENT as "filter matches"
| eval nip=mvmap(nipmatch,if(mvindex(split(nipmatch,","),0)="1",nipmatch,null))
| fields - nipmatch match
| rename COMMENT as "expand matching data from first index"
| mvexpand nip
| rename COMMENT as "extract original data (ignoring match flag)"
| rex field=nip ",(?&amp;lt;name&amp;gt;[^,]+),(?&amp;lt;io&amp;gt;[^,]+),(?&amp;lt;prot&amp;gt;.+)"
| fields - nip
| rename COMMENT as "table data"
| table prot io app cust pattern dir&lt;/LI-CODE&gt;&lt;P&gt;Assumptions include you search both indexes at once, e.g. index=idx1 OR index=idx2; using comma delimiters doesn't present a problem; and, you are using at least 8.0.0 as mvmap isn't supported in earlier versions. There may be a more efficient way to do this, but I will leave that to others to come up with.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:13:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526641#M148648</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-27T13:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526849#M148711</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for solution.&lt;/P&gt;&lt;P&gt;Actually field directory name in index2 is "dir2". I tried to rename it to "dir" but its overwriting all the values in index1.&lt;BR /&gt;It works fine if both the index has "dir" as field name.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 12:32:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526849#M148711</guid>
      <dc:creator>ved08514</dc:creator>
      <dc:date>2020-10-28T12:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526852#M148713</link>
      <description>&lt;P&gt;Insert a coalesce before the stats&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename COMMENT as "list data from both indexes by directory"
| eval dir=coalesce(dir,dir2)
| stats list(acp) as acp list(nip) as nip by dir&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Oct 2020 12:50:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/526852#M148713</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-28T12:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527017#M148757</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am facing one issue here. even if my index is having 600+ records i am getting only 200 records in output. I tried to increase number of records in index but still it showing 200 records.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:19:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527017#M148757</guid>
      <dc:creator>ved08514</dc:creator>
      <dc:date>2020-10-29T08:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527030#M148764</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228139"&gt;@ved08514&lt;/a&gt;&amp;nbsp;Do you get any useful information about what might be causing this from the job inspection? Is your time period correct? Can you try modifying the query to target the missing records to see if you can retrieve them in other ways?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:08:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527030#M148764</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-29T09:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527041#M148766</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried to modify the runanywhere data in original query you provided. There also I am seeing the same issue.&lt;BR /&gt;I added more records in index2 like 400 but I am seeing less data.&lt;BR /&gt;&lt;BR /&gt;Attached full query.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527041#M148766</guid>
      <dc:creator>ved08514</dc:creator>
      <dc:date>2020-10-29T09:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527048#M148769</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I just saw below error in Job button dropdown&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;stats' command: limit for values of field 'nip' reached. Some values may have been truncated or ignored.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 10:00:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527048#M148769</guid>
      <dc:creator>ved08514</dc:creator>
      <dc:date>2020-10-29T10:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527057#M148773</link>
      <description>&lt;P&gt;Update your limits.conf configuration to increase the size of the list stats can return&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/limitsconf#.5Bstats.7Csistats.5D" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Admin/limitsconf#.5Bstats.7Csistats.5D&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 10:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527057#M148773</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-29T10:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Join two indexes based on substring match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527059#M148774</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks. That worked.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 10:38:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-indexes-based-on-substring-match/m-p/527059#M148774</guid>
      <dc:creator>ved08514</dc:creator>
      <dc:date>2020-10-29T10:38:45Z</dc:date>
    </item>
  </channel>
</rss>

