<?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: Help with join command that is not producing correct results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442753#M125684</link>
    <description>&lt;P&gt;The query you ran does not match the query I provided.  How did my query fail?  Yours fails because the &lt;CODE&gt;join&lt;/CODE&gt; command is still looking for the 'apiName' field and the &lt;CODE&gt;stats&lt;/CODE&gt; commands are still not producing a field by that name.  &lt;/P&gt;

&lt;P&gt;Examine each &lt;CODE&gt;stats&lt;/CODE&gt; command and look at each word that follows "as" and "by".  Those words are the only field names that will work as joining fields.&lt;/P&gt;</description>
    <pubDate>Sun, 11 Aug 2019 12:22:41 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-08-11T12:22:41Z</dc:date>
    <item>
      <title>Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442747#M125678</link>
      <description>&lt;P&gt;Hi I have two searches&lt;BR /&gt;
search a :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*tech* sourcetype=technical_rproxy_access OR  sourcetype=technical_mule_api    NOT statusCode="0" | rex field=source "/appvol/(?[\w\/]+)/logs.*" |  stats  count as GWcount values(apiName) as APIatGW ,values(statusCode) as StatusatGW by MULE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search b: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=technical_rproxy_access | rex field=api_name "api\/(?[\w\-]+)*" |rename api_name as apiName|stats count as RPCount values(apiName) as APIatRproxy , values(status) as StatusatRproxy
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have combined two as below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*tech* sourcetype=technical_rproxy_access OR  sourcetype=technical_mule_api    NOT statusCode="0" | rex field=source "/appvol/(?[\w\/]+)/logs.*" |  stats  count as GWcount values(apiName) as APIatGW ,values(statusCode) as StatusatGW by MULE   | join type=left max=0 apiName [ search index=* sourcetype=technical_rproxy_access | rex field=api_name "api\/(?[\w\-]+)*" |rename api_name as apiName|stats count as RPCount values(apiName) as APIatRproxy , values(status) as StatusatRproxy]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to join two results such that apiName will be common in both, but my result is not working.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 21:07:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442747#M125678</guid>
      <dc:creator>madhuragujarath</dc:creator>
      <dc:date>2019-08-09T21:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442748#M125679</link>
      <description>&lt;P&gt;The &lt;CODE&gt;join&lt;/CODE&gt; is expecting field called 'apiName', but neither search's results contain that field.  Instead, the &lt;CODE&gt;stats&lt;/CODE&gt; commands return 'GWcount', 'APIatGW', 'StatusatGW', 'RPcount', 'APIatRproxy', and 'StatusatRproxy'.  For &lt;CODE&gt;join&lt;/CODE&gt; to work, there must be at least one common field name on both sides of the join.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 23:53:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442748#M125679</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-09T23:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442749#M125680</link>
      <description>&lt;P&gt;Hi..Thank you for replying back..in my main search there is one field called apiName..are you saying because I made it values(apiName) as APIatGW I should use APIatGW  field ?&lt;/P&gt;

&lt;P&gt;in my subsearch there is field called api_Name ..do you think below should work ?&lt;/P&gt;

&lt;P&gt;index=&lt;EM&gt;tech&lt;/EM&gt; sourcetype=technical_rproxy_access OR  sourcetype=technical_mule_api    NOT statusCode="0" | rex field=source "/appvol/(?[\w\/]+)/logs.&lt;EM&gt;" |  stats  count as GWcount values(apiName) as APIatGW ,values(statusCode) as StatusatGW by MULE   | join type=left max=0 APIatGW [ search index=&lt;/EM&gt; sourcetype=technical_rproxy_access | rex field=api_name "api\/(?[\w-]+)*" |rename api_name as APIatGW |stats count as RPCount values(apiName) as APIatRproxy , values(status) as StatusatRproxy]&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:42:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442749#M125680</guid>
      <dc:creator>madhuragujarath</dc:creator>
      <dc:date>2020-09-30T01:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442750#M125681</link>
      <description>&lt;P&gt;Hi..Thank you for reply I tried below &lt;/P&gt;

&lt;P&gt;index=&lt;EM&gt;tech&lt;/EM&gt; sourcetype=technical_rproxy_access OR  sourcetype=technical_mule_api    NOT statusCode="0" | rex field=source "/appvol/(?[\w\/]+)/logs.&lt;EM&gt;" |  stats  count as GWcount values(apiName) as APIatGW ,values(statusCode) as StatusatGW by MULE  | join type=left max=0 APIatGW [ search index=&lt;/EM&gt; sourcetype=technical_rproxy_access | rex field=api_name "api\/(?[\w-]+)*" |rename api_name as APIatGW|stats count as RPCount values(apiName) as APIatRproxy , values(status) as StatusatRproxy]&lt;/P&gt;

&lt;P&gt;Actually what is happening is 1st result gets APIatGW separated by MULE which I want  but in for 2nd result its showing no data&lt;/P&gt;

&lt;P&gt;I am really stuck with this to get working so thank you for any help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:42:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442750#M125681</guid>
      <dc:creator>madhuragujarath</dc:creator>
      <dc:date>2020-09-30T01:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442751#M125682</link>
      <description>&lt;P&gt;It's important to know the &lt;CODE&gt;stats&lt;/CODE&gt; command filters fields, much like &lt;CODE&gt;fields&lt;/CODE&gt; and &lt;CODE&gt;table&lt;/CODE&gt;.  Any field not mentioned in &lt;CODE&gt;stats&lt;/CODE&gt; will not be available to later commands.  This is why your example cannot join on apiName.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*tech* sourcetype=technical_rproxy_access OR sourcetype=technical_mule_api NOT statusCode="0" 
| rex field=source "/appvol/(?[\w\/]+)/logs.*" 
|  stats  count as GWcount values(apiName) as apiName, values(statusCode) as StatusatGW by MULE 
| join type=left max=0 apiName [ search index=* sourcetype=technical_rproxy_access 
  | rex field=api_name "api\/(?[\w\-]+)*" 
  |stats count as RPCount values(api_name) as apiName, values(status) as StatusatRproxy]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Aug 2019 11:46:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442751#M125682</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-10T11:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442752#M125683</link>
      <description>&lt;P&gt;Thank you for checking..:) &lt;BR /&gt;
I ran below &lt;/P&gt;

&lt;P&gt;index=&lt;EM&gt;tech&lt;/EM&gt; sourcetype=technical_rproxy_access OR sourcetype=technical_mule_api NOT statusCode="0" &lt;BR /&gt;
  |rex field=source "/appvol/(?[\w\/]+)/logs.&lt;EM&gt;" |  stats  count as GWcount values(apiName) as api_name, values(statusCode) as status by MULE &lt;BR /&gt;
 | join type=outer max=0 apiName [ search index=&lt;/EM&gt; sourcetype=technical_rproxy_access &lt;BR /&gt;
   | rex field=api_name "api\/(?[\w-]+)*" | rename api_name as apiName&lt;BR /&gt;
   |stats count as RPCount values(apiName) as api, values(status) as StatusatRproxy]&lt;/P&gt;

&lt;P&gt;my inner serach is having field called as api_name in data . My outer search has field called as apiName in data . I have passed on apiName to join command ..and then in order to make apiName matches with api_name I have renamed the field . Problem is there are correct results for outer search but inner search is same for each of outer search &lt;/P&gt;

&lt;P&gt;e.g. o/p of total command looks like below &lt;/P&gt;

&lt;P&gt;MULE    GWcount         api_name                    status              RPCount         StatusatRproxy          api&lt;BR /&gt;
mule1   123324          account--hk-hase-pib-services-papi-proxy    200 201             62035           200 201         /cmb-dbbhase-banking-pa-common-prod-internal-proxy account--hk-hase-pib-services-papi-prod-internal-proxy account--hk-hase-pib-services-papi-prod-proxy api/account--hk-hase-&lt;BR /&gt;
                mobilex-my-accounts-eapi-proxy&lt;/P&gt;

&lt;P&gt;I want api and api_name to be matching in line&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:42:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442752#M125683</guid>
      <dc:creator>madhuragujarath</dc:creator>
      <dc:date>2020-09-30T01:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442753#M125684</link>
      <description>&lt;P&gt;The query you ran does not match the query I provided.  How did my query fail?  Yours fails because the &lt;CODE&gt;join&lt;/CODE&gt; command is still looking for the 'apiName' field and the &lt;CODE&gt;stats&lt;/CODE&gt; commands are still not producing a field by that name.  &lt;/P&gt;

&lt;P&gt;Examine each &lt;CODE&gt;stats&lt;/CODE&gt; command and look at each word that follows "as" and "by".  Those words are the only field names that will work as joining fields.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 12:22:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442753#M125684</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-11T12:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442754#M125685</link>
      <description>&lt;P&gt;Hi.. I tried query you gave but it shows no results for inner search I mean" stats count as RPCount values(api_name) as apiName, values(status) as StatusatRproxy"&lt;/P&gt;

&lt;P&gt;is all blank data ..I am not sure if that is happening because in my first search there os 'by MULE' in main statement ?&lt;/P&gt;

&lt;P&gt;MULE    GWcount apiName StatusatGW  RPCount StatusatRproxy&lt;BR /&gt;
mule1   61357&lt;BR /&gt;&lt;BR /&gt;
account--hk-hase-pib-services-papi-proxy&lt;BR /&gt;
beluga-accounteligibilitycheck-hk-hsbc-proxy&lt;BR /&gt;
200&lt;BR /&gt;
201&lt;/P&gt;

&lt;P&gt;added part for result above ..it shows blank for RPCount and     StatusatRproxy  &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 00:03:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442754#M125685</guid>
      <dc:creator>madhuragujarath</dc:creator>
      <dc:date>2019-08-12T00:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442755#M125686</link>
      <description>&lt;P&gt;in addition if I ran individually inner query I get result &lt;/P&gt;

&lt;P&gt;index=* sourcetype=technical_rproxy_access      | rex field=api_name "api\/(?[\w-]+)*"      |eval StatusatRproxy=status|stats count as RPCount values(api_name) as apiName, values(status) as StatusatRproxy&lt;/P&gt;

&lt;P&gt;But please note that above result just give me single row result what I want is the way outer result is giving me new rows by MULE ( this MULE field is only present in sourcetype=technical_mule not sure if that is causing failure of result )..I want join search to 1st: make new row by MULE 2nd : for each apiName list (e.g pqrs &amp;amp; tuvw ) if inner serach has  this api_name matching then it should give count of matching ones &lt;/P&gt;

&lt;P&gt;So expecting result in below ..&lt;BR /&gt;
MULE    GWcount apiName       StatusatGW    RPCount StatusatRproxy&lt;BR /&gt;
mule1   100                  pqrs  tuvw     200 400               98                     404 200 201&lt;BR /&gt;
Mule2    50                    abcd  efgh     200 201              48                     302 200&lt;/P&gt;

&lt;P&gt;But I am getting &lt;BR /&gt;
MULE    GWcount apiName       StatusatGW    RPCount StatusatRproxy&lt;BR /&gt;
mule1   100                  pqrs  tuvw     200 400&lt;BR /&gt;&lt;BR /&gt;
Mule2    50                    abcd  efgh     200 201             &lt;/P&gt;

&lt;P&gt;Let me know if I can call any number etc to help further explaning this ..&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:42:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442755#M125686</guid>
      <dc:creator>madhuragujarath</dc:creator>
      <dc:date>2020-09-30T01:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442756#M125687</link>
      <description>&lt;P&gt;I was so focused on the missing apiName field that I completely missed the missing &lt;CODE&gt;by&lt;/CODE&gt; clause.  Without &lt;CODE&gt;by&lt;/CODE&gt;, the &lt;CODE&gt;stats&lt;/CODE&gt; command creates a single set of of statistics, which of course don't match well with numbers grouped by MULE.&lt;BR /&gt;
Since the second search does not have a MULE field, the &lt;CODE&gt;join&lt;/CODE&gt; command will not work.  Perhaps &lt;CODE&gt;appendcols&lt;/CODE&gt; will do the job.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 12:16:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442756#M125687</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-12T12:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with join command that is not producing correct results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442757#M125688</link>
      <description>&lt;P&gt;This will get you started:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index="*tech*" AND (sourcetype="technical_rproxy_access" OR  sourcetype="technical_mule_api") AND NOT statusCode="0") OR
(index="*" AND sourcetype="technical_rproxy_access")
| rex field=source "/appvol/(?&amp;lt;api_name_A&amp;gt;[\w\/]+)/logs.*"
| rex field=api_name "api\/(?&amp;lt;api_name_B&amp;gt;[\w\-]+)*"
| eval api_name_joiner = coalesce(api_name_A, api_name_B)
| eval MULE = coalesce(MULE, "null")
|  stats  count(api_name_A) AS GWcount count(api_name_B) AS RPCount values(api_name_A) AS APIatGW values(api_name_B) AS APIatRproxy values(statusCode) AS StatusatGW BY MULE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you might do something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval api_name_joiner = coalesce(api_name_A, api_name_B)
| stats Some Stuff Here BY api_name_joiner
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Nov 2019 23:05:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-join-command-that-is-not-producing-correct-results/m-p/442757#M125688</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-10T23:05:32Z</dc:date>
    </item>
  </channel>
</rss>

