<?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 searches by different field names in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165670#M47095</link>
    <description>&lt;P&gt;Your subsearches don't have a currentPage field - they have pageviews.  That aside, I think you'd have better results with the appendcols command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ecom" eventName=pageLoad | regex referrer="^http://www.example.com/these-files/*" | rex field=referrer "(?.*?)?" | rex field=new_referrer mode=sed "s/^http://www.example.com/ /g" | stats count as clicksOut by new_referrer | rename new_referrer as currentPage | appendcols [search index="ecom" eventName=pageLoad | stats count as pageViews by currentPage] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Apr 2015 17:56:17 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2015-04-24T17:56:17Z</dc:date>
    <item>
      <title>Join two searches by different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165668#M47093</link>
      <description>&lt;P&gt;I have a search I'm running which now works fine&lt;/P&gt;

&lt;P&gt;index="ecom" eventName=pageLoad | regex referrer="^&lt;A href="http://www.example.com/these-files/*" target="_blank"&gt;http://www.example.com/these-files/*&lt;/A&gt;" | rex field=referrer "(?.*?)\?" | rex field=new_referrer mode=sed "s/^http:\/\/&lt;A href="http://www.example.com/" target="_blank"&gt;www.example.com/&lt;/A&gt; /g"  | stats count as clicksOut by new_referrer | rename new_referrer as currentPage &lt;/P&gt;

&lt;P&gt;This gets me results such as&lt;BR /&gt;
currentPage - clicksOut&lt;BR /&gt;
/these-files/abc - 4&lt;BR /&gt;
/these-files/def - 5&lt;/P&gt;

&lt;P&gt;etc.&lt;/P&gt;

&lt;P&gt;I am now trying to join a separate search based on the currentPage field&lt;/P&gt;

&lt;P&gt;| join currentPage [search index="ecom" eventName=pageLoad | stats count as pageViews by currentPage]&lt;/P&gt;

&lt;P&gt;If I run this search I get back a variety of results (as should be)&lt;BR /&gt;
/ - 100&lt;BR /&gt;
/these-files - 400&lt;BR /&gt;
/these-files/abc - 10&lt;BR /&gt;
/these-files/def - 5&lt;/P&gt;

&lt;P&gt;Ideally when the join occurs I'd have a list of all clicksOut and pageViews&lt;BR /&gt;
currentPage - clicksOut - pageViews&lt;BR /&gt;
/these-files/abc - 4 - 10&lt;BR /&gt;
/these-files/def - 5 - 5&lt;/P&gt;

&lt;P&gt;When I run the full search below I get no results though - any ideas?&lt;/P&gt;

&lt;P&gt;index="ecom" eventName=pageLoad | regex referrer="^&lt;A href="http://www.example.com/these-files/*" target="_blank"&gt;http://www.example.com/these-files/*&lt;/A&gt;" | rex field=referrer "(?.*?)\?" | rex field=new_referrer mode=sed "s/^http:\/\/&lt;A href="http://www.example.com/" target="_blank"&gt;www.example.com/&lt;/A&gt; /g"  | stats count as clicksOut by new_referrer | rename new_referrer as currentPage | join currentPage [search index="ecom" eventName=pageLoad | stats count as pageViews by currentPage]&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:40:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165668#M47093</guid>
      <dc:creator>akhanVG</dc:creator>
      <dc:date>2020-09-28T19:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Join two searches by different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165669#M47094</link>
      <description>&lt;P&gt;You shouldn't need to do the same join twice here and you can use join type=left to still get your original result set even if noting matched. Try removing the last join and change the first one to join type=left and let us all know the results. It may be that the joined result set has no matches or doesn't exist.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 17:52:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165669#M47094</guid>
      <dc:creator>dolivasoh</dc:creator>
      <dc:date>2015-04-24T17:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Join two searches by different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165670#M47095</link>
      <description>&lt;P&gt;Your subsearches don't have a currentPage field - they have pageviews.  That aside, I think you'd have better results with the appendcols command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ecom" eventName=pageLoad | regex referrer="^http://www.example.com/these-files/*" | rex field=referrer "(?.*?)?" | rex field=new_referrer mode=sed "s/^http://www.example.com/ /g" | stats count as clicksOut by new_referrer | rename new_referrer as currentPage | appendcols [search index="ecom" eventName=pageLoad | stats count as pageViews by currentPage] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Apr 2015 17:56:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165670#M47095</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-04-24T17:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Join two searches by different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165671#M47096</link>
      <description>&lt;P&gt;Oh shoot that was a mistake in formatting there is only one join but I'll see if left works&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 17:56:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165671#M47096</guid>
      <dc:creator>akhanVG</dc:creator>
      <dc:date>2015-04-24T17:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Join two searches by different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165672#M47097</link>
      <description>&lt;P&gt;No dice - I tried this but the clicksOut always comes up as blank.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 18:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165672#M47097</guid>
      <dc:creator>akhanVG</dc:creator>
      <dc:date>2015-04-24T18:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Join two searches by different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165673#M47098</link>
      <description>&lt;P&gt;If this works for you, please click "Accept Answer"...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ecom" eventName=pageLoad 
| regex referrer="^http://www.example.com/these-files/*" 
| rex field=referrer "(?.*?)?" 
| rex field=new_referrer mode=sed "s/^http://www.example.com/ /g"
| stats count as pageViews, count(eval(new_referrer="*")) as clicksOut by currentPage
| fillnull value=0 pageViews clicksOut 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Apr 2015 18:54:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-searches-by-different-field-names/m-p/165673#M47098</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2015-04-24T18:54:12Z</dc:date>
    </item>
  </channel>
</rss>

