<?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 do I join/combine my two search searches to get my expected result in a single table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245307#M73116</link>
    <description>&lt;P&gt;How about this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?&amp;lt;id&amp;gt;\w+) typecode=" | rex "(?&amp;lt;state&amp;gt;\w+) status=" | table id, typecode, state, status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?&amp;lt;id&amp;gt;\w+) typecode=" | rex "(?&amp;lt;state&amp;gt;\w+) status=" | eventstats values(status) as status by id code |  table id, typecode, state, status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?&amp;lt;id&amp;gt;\w+) typecode=" | rex "(?&amp;lt;state&amp;gt;\w+) status=" | stats values(state) as state by id, typecode, status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 Aug 2016 18:35:38 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-08-24T18:35:38Z</dc:date>
    <item>
      <title>How do I join/combine my two search searches to get my expected result in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245306#M73115</link>
      <description>&lt;P&gt;join/combine two searches into single table, duplicate records override with the first value.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search1:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?\w+) typecode=" | table id, type, code 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID    Type     Code
1111    MethodA 201
1111    MethodA 200
1111    MethodA 201
2222    MethodA 200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Search2:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?\w+) status=" | table id, staus
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID    Status
1111    POST
1111    PRE
1111    POST
2222    PRE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;join Search:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?\w+) typecode=" | table id, type, code | join id [ search host=test* sourcetype=coner | rex "(?\w+) status=" | table id, staus] | table id, type, code, staus
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID    Type     Code   Status
1111    MethodA 201 POST
1111    MethodA 200 POST
1111    MethodA 201 POST
2222    MethodA 200 PRE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;I want to combine Search1 &amp;amp; Search2, and expecting the table as:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID    Type     Code   Status
1111    MethodA 201 POST
1111    MethodA 200 PRE
1111    MethodA 201 POST
2222    MethodA 200 PRE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please suggest me the best solution to achieve this.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 17:54:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245306#M73115</guid>
      <dc:creator>Bhanus1</dc:creator>
      <dc:date>2016-08-24T17:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join/combine my two search searches to get my expected result in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245307#M73116</link>
      <description>&lt;P&gt;How about this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?&amp;lt;id&amp;gt;\w+) typecode=" | rex "(?&amp;lt;state&amp;gt;\w+) status=" | table id, typecode, state, status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?&amp;lt;id&amp;gt;\w+) typecode=" | rex "(?&amp;lt;state&amp;gt;\w+) status=" | eventstats values(status) as status by id code |  table id, typecode, state, status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "(?&amp;lt;id&amp;gt;\w+) typecode=" | rex "(?&amp;lt;state&amp;gt;\w+) status=" | stats values(state) as state by id, typecode, status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Aug 2016 18:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245307#M73116</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-24T18:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join/combine my two search searches to get my expected result in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245308#M73117</link>
      <description>&lt;P&gt;If the data is in one log we can get this.&lt;BR /&gt;
But i have two log events fetching different data and joining.&lt;BR /&gt;
Ex:&lt;BR /&gt;
&lt;STRONG&gt;Query1:&lt;/STRONG&gt;&lt;BR /&gt;
host=test* sourcetype=coner | rex "(?&amp;lt;\id&amp;gt;\w+) typecode=" | table id, type, code&lt;BR /&gt;
2016-08-24 15:08:56.347 13278031 INFO  com.utils.Utils - MethodA() 1111 typecode=201 type=MethodA&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query2:&lt;/STRONG&gt;&lt;BR /&gt;
host=test* sourcetype=coner | rex "(?&amp;lt;\id&amp;gt;\w+) status=" | table id, staus&lt;BR /&gt;
2016-08-24 15:08:56.347 13278031 INFO  com.utils.Utils - MethodA() 1111 status=POST&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 06:07:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245308#M73117</guid>
      <dc:creator>Bhanus1</dc:creator>
      <dc:date>2016-08-25T06:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join/combine my two search searches to get my expected result in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245309#M73118</link>
      <description>&lt;P&gt;In that case, try the updated answer&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 12:31:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245309#M73118</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-25T12:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join/combine my two search searches to get my expected result in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245310#M73119</link>
      <description>&lt;P&gt;Thanks Sundar for quick response.&lt;BR /&gt;
But still no luck :(.&lt;BR /&gt;
Two log events looks like:&lt;BR /&gt;
2016-08-24 15:08:56.344 13278031 INFO com.utils.Utils - MethodA() 1111 status=POST&lt;BR /&gt;
2016-08-24 15:08:56.347 13278031 INFO com.utils.Utils - MethodA() 1111 typecode=201 type=MethodA&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 09:27:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245310#M73119</guid>
      <dc:creator>Bhanus1</dc:creator>
      <dc:date>2016-08-26T09:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join/combine my two search searches to get my expected result in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245311#M73120</link>
      <description>&lt;P&gt;How about this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "\s+(?&amp;lt;id&amp;gt;\d+)\s+[status|typecode]" | eventstats values(status) as status by id | search typecode=* | table id, typecode, state, status type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=test* sourcetype=coner | rex "\s+(?&amp;lt;id&amp;gt;\d+)\s+[status|typecode]" | stats values(status) as status by id, typecode type
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 14:14:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-combine-my-two-search-searches-to-get-my-expected/m-p/245311#M73120</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-26T14:14:36Z</dc:date>
    </item>
  </channel>
</rss>

