<?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 to display respective entries from two different logs based on a common extracted field value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289933#M163877</link>
    <description>&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 07 Jan 2018 07:03:49 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2018-01-07T07:03:49Z</dc:date>
    <item>
      <title>How to display respective entries from two different logs based on a common extracted field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289932#M163876</link>
      <description>&lt;P&gt;Hi All, &lt;BR /&gt;
I have two different sources of log and want to display respective entries from each source based on a extracted field value from the first log. For e.g:&lt;BR /&gt;
&lt;STRONG&gt;Log 1&lt;/STRONG&gt;: Jan 6 15:33:13 xxxxx : trans(2735890423)[response][247.116.54.12] gtid(&lt;STRONG&gt;&lt;EM&gt;2735890423&lt;/EM&gt;&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; |Test|service|247.116.54.12|2f4ad7ae-a4f9-324d-8d1a-8d98b414c496|&lt;STRONG&gt;&lt;EM&gt;2735890423&lt;/EM&gt;&lt;/STRONG&gt;||||/rest/services|documentId&lt;BR /&gt;
Note -  the field that need to be extracted from this log is value of gtid(2735890423), which is extracted as tranid. (highlighted with bold font)&lt;BR /&gt;
&lt;STRONG&gt;Log 2&lt;/STRONG&gt;: Jan 6 15:33:13 xxxxx : trans(2316097519)[response] gtid(2735890423): |Test|service|transaction type|response||2f4ad7ae-a4f9-324d-8d1a-8d98b414c496|&lt;STRONG&gt;&lt;EM&gt;2735890423&lt;/EM&gt;&lt;/STRONG&gt;:2316097519|2018-01-06T15:33:13-08:00|5|86|86|success|200 OK&lt;/P&gt;

&lt;P&gt;Requirement is, get the value of the dptranid from log 1 and search the other source log for respective entries. This has to be done dynamically, meaning the entry from log 1 has to be search from a different search param but the query has to be in such a way that it returns entry from both logs.&lt;/P&gt;

&lt;P&gt;For eg: as of know we are using: index="log1" /rest/services  --&amp;gt; which results in entries from log 1. then we manually select the tran id from the log and then use another search query to get the result from log 2. I want to write a single query for the same purpose.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 00:05:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289932#M163876</guid>
      <dc:creator>amiivas</dc:creator>
      <dc:date>2018-01-07T00:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to display respective entries from two different logs based on a common extracted field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289933#M163877</link>
      <description>&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 07:03:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289933#M163877</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-01-07T07:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to display respective entries from two different logs based on a common extracted field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289934#M163878</link>
      <description>&lt;P&gt;hey amiivas,&lt;/P&gt;

&lt;P&gt;Try this run anywhere search :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="Jan 6 15:33:13 xxxxx : trans(2735890423)[response][247.116.54.12] gtid(2735890423): |Test|service|247.116.54.12|2f4ad7ae-a4f9-324d-8d1a-8d98b414c496|2735890423||||/rest/services|documentId" 
| append 
    [| makeresults 
    | eval _raw="Jan 6 15:33:13 xxxxx : trans(2316097519)[response] gtid(2735890423): |Test|service|transaction type|response||2f4ad7ae-a4f9-324d-8d1a-8d98b414c496|2735890423:2316097519|2018-01-06T15:33:13-08:00|5|86|86|success|200 OK"] 
| rex field=_raw "gtid\((?P&amp;lt;trans_id&amp;gt;[^])]+)" 
| stats values(_raw) as raw_event by trans_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to try with raw logs then assuming that you have two seperate indexes i.e. &lt;CODE&gt;index1 and index2&lt;/CODE&gt; for both sources try this: NOTE: if you have only one index then write only &lt;CODE&gt;index=your_index (source=source1 */rest/services* OR source=source2&lt;/CODE&gt;)   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=index1  OR index=index2  (source=source1 */rest/services* OR source=source2)
    | rex field=_raw "gtid\((?P&amp;lt;trans_id&amp;gt;[^])]+)" 
    | stats values(_raw) as raw_event by trans_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that helps you!&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 07:34:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289934#M163878</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-07T07:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to display respective entries from two different logs based on a common extracted field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289935#M163879</link>
      <description>&lt;P&gt;Hi mayurr98,&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=index1  OR index=index2  (source=source1 */rest/services* OR source=source2) | rex field=_raw "gtid\((?P&amp;lt;trans_id&amp;gt;[^])]+)"         | stats values(_raw) as raw_event by trans_id&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I was trying with raw logs and the above query only resulted in entries from Log 1. &lt;/P&gt;

&lt;P&gt;But your anywhere search is working as what expected. &lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 20:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289935#M163879</guid>
      <dc:creator>amiivas</dc:creator>
      <dc:date>2018-01-08T20:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to display respective entries from two different logs based on a common extracted field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289936#M163880</link>
      <description>&lt;P&gt;Okay the problem must be in initial filter search &lt;/P&gt;

&lt;P&gt;Can you just run &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1  OR index=index2  ((source=source1 */rest/services*) OR source=source2))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See if you are able to get logs from both sources??&lt;BR /&gt;
If yes then run rex command and see if trans_id is getting extracted from both searches and like this you can troubleshoot!&lt;/P&gt;

&lt;P&gt;Let me know if this helps you!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 03:39:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289936#M163880</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-09T03:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to display respective entries from two different logs based on a common extracted field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289937#M163881</link>
      <description>&lt;P&gt;Thanks it worked.. Awesome thanks. Did some here and there, some extra brackets, some more filtering  and it worked.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 03:58:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-respective-entries-from-two-different-logs-based/m-p/289937#M163881</guid>
      <dc:creator>amiivas</dc:creator>
      <dc:date>2018-01-09T03:58:53Z</dc:date>
    </item>
  </channel>
</rss>

