<?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 coalesce values of Outsearch and Subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562478#M195622</link>
    <description>&lt;P&gt;Hi Splunk experts,&lt;/P&gt;&lt;P&gt;I have below usecase and using below query&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=Index1 app_name IN ("customer","contact")

| rex field=msg.message.details "\"accountUuid\":\"(?&amp;lt;SFaccountUUID&amp;gt;[^\n\r\"]+)"

| rex field=msg.message.details "\"contactId\":\"(?&amp;lt;SFcontactUUID&amp;gt;[^\n\r\"]+)"

|rex field=msg.details "\'customerCode\'\=\'(?&amp;lt;cac&amp;gt;[^\n\r\']{10})\'"

| rename msg.correlationId AS correlationId

| stats latest(SFcontactUUID) as contactUUID,latest(SFaccountUUID) as accountUUID,values(msg.tag.Status) as QStatus,values(msg.tag.errorMessage) as Q_errorMessage,values(msg.tag.errorCode) as Q_errorCode by correlationId

| join type=left correlationId [search index=index2 app_name="contact1"

|rename  msg.message.header.correlationId AS correlationId

|stats values(msg.message.header.Status) AS DStatus,values(msg.message.header.eventName) AS eventName,values(msg.message.header.errorMessage) as D_errorMessage,values(msg.message.header.errorCode) as D_errorCode by correlationId]

The common identifier between the 2 searches is the correlationId. Below is sample result

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE width="701"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="75"&gt;correlationId&lt;/TD&gt;&lt;TD width="90"&gt;contactUUID&lt;/TD&gt;&lt;TD width="101"&gt;accountUUID&lt;/TD&gt;&lt;TD width="118"&gt;Q_errorMessage&lt;/TD&gt;&lt;TD width="88"&gt;Q_errorCode&lt;/TD&gt;&lt;TD width="91"&gt;D_errorCode&lt;/TD&gt;&lt;TD width="138"&gt;D_errorMessage&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="75"&gt;ab861125-6cd7-493b-999f-ef9b2edd8315023758601&lt;/TD&gt;&lt;TD width="90"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="101"&gt;C0DABCC1-EFC8-11eb-A67A-005056B89B42&lt;/TD&gt;&lt;TD width="118"&gt;null&lt;/TD&gt;&lt;TD width="88"&gt;null&lt;/TD&gt;&lt;TD width="91"&gt;201 null&lt;/TD&gt;&lt;TD width="138"&gt;null { "ContactUUID": "b020c98a-43f5-d6b3-e983-45ffddf52a73"}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Is it possible to coalesce the value of highlighted in red from subsearch into the ContactUUID field in the outersearch?I am expecting this value either in outer or subsearch and so how can I solve it?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Aug 2021 03:35:29 GMT</pubDate>
    <dc:creator>prasant</dc:creator>
    <dc:date>2021-08-07T03:35:29Z</dc:date>
    <item>
      <title>coalesce values of Outsearch and Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562478#M195622</link>
      <description>&lt;P&gt;Hi Splunk experts,&lt;/P&gt;&lt;P&gt;I have below usecase and using below query&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=Index1 app_name IN ("customer","contact")

| rex field=msg.message.details "\"accountUuid\":\"(?&amp;lt;SFaccountUUID&amp;gt;[^\n\r\"]+)"

| rex field=msg.message.details "\"contactId\":\"(?&amp;lt;SFcontactUUID&amp;gt;[^\n\r\"]+)"

|rex field=msg.details "\'customerCode\'\=\'(?&amp;lt;cac&amp;gt;[^\n\r\']{10})\'"

| rename msg.correlationId AS correlationId

| stats latest(SFcontactUUID) as contactUUID,latest(SFaccountUUID) as accountUUID,values(msg.tag.Status) as QStatus,values(msg.tag.errorMessage) as Q_errorMessage,values(msg.tag.errorCode) as Q_errorCode by correlationId

| join type=left correlationId [search index=index2 app_name="contact1"

|rename  msg.message.header.correlationId AS correlationId

|stats values(msg.message.header.Status) AS DStatus,values(msg.message.header.eventName) AS eventName,values(msg.message.header.errorMessage) as D_errorMessage,values(msg.message.header.errorCode) as D_errorCode by correlationId]

The common identifier between the 2 searches is the correlationId. Below is sample result

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE width="701"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="75"&gt;correlationId&lt;/TD&gt;&lt;TD width="90"&gt;contactUUID&lt;/TD&gt;&lt;TD width="101"&gt;accountUUID&lt;/TD&gt;&lt;TD width="118"&gt;Q_errorMessage&lt;/TD&gt;&lt;TD width="88"&gt;Q_errorCode&lt;/TD&gt;&lt;TD width="91"&gt;D_errorCode&lt;/TD&gt;&lt;TD width="138"&gt;D_errorMessage&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="75"&gt;ab861125-6cd7-493b-999f-ef9b2edd8315023758601&lt;/TD&gt;&lt;TD width="90"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="101"&gt;C0DABCC1-EFC8-11eb-A67A-005056B89B42&lt;/TD&gt;&lt;TD width="118"&gt;null&lt;/TD&gt;&lt;TD width="88"&gt;null&lt;/TD&gt;&lt;TD width="91"&gt;201 null&lt;/TD&gt;&lt;TD width="138"&gt;null { "ContactUUID": "b020c98a-43f5-d6b3-e983-45ffddf52a73"}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Is it possible to coalesce the value of highlighted in red from subsearch into the ContactUUID field in the outersearch?I am expecting this value either in outer or subsearch and so how can I solve it?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Aug 2021 03:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562478#M195622</guid>
      <dc:creator>prasant</dc:creator>
      <dc:date>2021-08-07T03:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: coalesce values of Outsearch and Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562486#M195623</link>
      <description>&lt;P&gt;You could try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=Index1 app_name IN ("customer","contact")
| rex field=msg.message.details "\"accountUuid\":\"(?&amp;lt;SFaccountUUID&amp;gt;[^\n\r\"]+)"
| rex field=msg.message.details "\"contactId\":\"(?&amp;lt;SFcontactUUID&amp;gt;[^\n\r\"]+)"
|rex field=msg.details "\'customerCode\'\=\'(?&amp;lt;cac&amp;gt;[^\n\r\']{10})\'"
| rename msg.correlationId AS correlationId
| stats latest(SFcontactUUID) as contactUUID,latest(SFaccountUUID) as accountUUID,values(msg.tag.Status) as QStatus,values(msg.tag.errorMessage) as Q_errorMessage,values(msg.tag.errorCode) as Q_errorCode by correlationId
| append [search index=index2 app_name="contact1"
| rex field=msg.message.header.errorCode "\"ContactUUID\":\"(?&amp;lt;SFcontactUUID&amp;gt;[^\n\r\"]+)"
| rename  msg.message.header.correlationId AS correlationId
|stats values(msg.message.header.Status) AS DStatus,values(msg.message.header.eventName) AS eventName,values(msg.message.header.errorMessage) as D_errorMessage,values(msg.message.header.errorCode) as D_errorCode values(SFContactUUID) and SFContactUUID by correlationId]
| stats values(*) as * by correlationId&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 07 Aug 2021 07:03:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562486#M195623</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-07T07:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: coalesce values of Outsearch and Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562503#M195628</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;/P&gt;&lt;P&gt;thanks for u r response, but your solution doesnt seem to work, I am using join( real time) so I can get the values of the subsearch as column, against the join condition. i.e common identifier is correlation ID.&lt;/P&gt;&lt;P&gt;Outer Search A,&amp;nbsp; Contact Column x&lt;/P&gt;&lt;P&gt;Subsearch B, Contact Column y&amp;nbsp;&lt;/P&gt;&lt;P&gt;Join condition correlationId&lt;/P&gt;&lt;P&gt;final stats/table should have combined result of column x and y along with all the other columns from Search A and Search B. The reason I want to combine the values is that, sometime Column x or Column Y will have the value.&lt;/P&gt;&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Aug 2021 03:17:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562503#M195628</guid>
      <dc:creator>prasant</dc:creator>
      <dc:date>2021-08-08T03:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: coalesce values of Outsearch and Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562509#M195629</link>
      <description>&lt;P&gt;Sorry typo (field names are case sensitive)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;values(SFcontactUUID) and SFcontactUUID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The final stats does "join" by correlation id; where field names are the same, the values from both searches are joined into multi-value fields, so SFcontactUUID will have values from both searches, so in your case, if it is only present in one search or the other, they are effectively coalesced into a single field.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Aug 2021 07:56:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562509#M195629</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-08T07:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: coalesce values of Outsearch and Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562519#M195633</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; Thanks it worked, I was thinking of using rex and combine the indexes in one search.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 00:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/coalesce-values-of-Outsearch-and-Subsearch/m-p/562519#M195633</guid>
      <dc:creator>prasant</dc:creator>
      <dc:date>2021-08-09T00:01:05Z</dc:date>
    </item>
  </channel>
</rss>

