<?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: Combining two searches for purpose of table &amp; stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-searches-for-purpose-of-table-stats/m-p/332088#M98782</link>
    <description>&lt;P&gt;Give this a try..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=our_index source="/user_projects/domains/gidprd/servers/qbp-*/logs/qnb-application-log/car-qnb-application.M6.log"
| rex "\[[^\:]*\:(?&amp;lt;sessionId&amp;gt;[^\:]*)"
| rex "\[[^\:]*\:(.*)\:\:\:M6.*aggregatorID\=\'(?&amp;lt;aggId&amp;gt;[^\']*)"
| rex "\[[^\:]*\:([^\:]*)\:(?&amp;lt;requestId&amp;gt;[^\:]*)" 
| stats values(aggId) as aggId dc(requestId) as counter by sessionId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Mar 2018 15:34:14 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-03-06T15:34:14Z</dc:date>
    <item>
      <title>Combining two searches for purpose of table &amp; stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-searches-for-purpose-of-table-stats/m-p/332087#M98781</link>
      <description>&lt;P&gt;Good afternoon all,&lt;/P&gt;

&lt;P&gt;Apologies for the below, my first question and also I'm a complete newbie to this. So, I have been asked by a user if it would be possible to combine two searches for the purpose of creating a table that has the resulting fields and also a stats count on one of the fields.&lt;/P&gt;

&lt;P&gt;Let me explain. The &lt;EM&gt;two&lt;/EM&gt; base searches are:-&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search 1:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=our_index "Initialising journeyContext using initial request parameters:[AggregatorInitialRequest{aggregatorID" source="/user_projects/domains/gidprd/servers/qbp-*/logs/qnb-application-log/car-qnb-application.M6.log"
| rex "\[[^\:]*\:(?&amp;lt;sessionId&amp;gt;.*)\:\:\:M6.*aggregatorID\=\'(?&amp;lt;aggId&amp;gt;[^\']*)"
| table sessionId aggId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Search 2&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=our_index source="/user_projects/domains/gidprd/servers/qbp-*/logs/qnb-application-log/car-qnb-application.M6.log" 
| rex "\[[^\:]*\:(?&amp;lt;sessionId&amp;gt;[^\:]*)\:(?&amp;lt;requestId&amp;gt;[^\:]*)" 
| dedup requestId 
| stats count as counter by sessionId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What the end user would like is a table that has sessionId | aggId | count&lt;/P&gt;

&lt;P&gt;Now I have played around trying to use the join command on sessionId, but to no avail and it's absolutely killing me.  I've got as far as trying this, but no results are returning:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=our_index "Initialising journeyContext using initial request parameters:[AggregatorInitialRequest{aggregatorID" source="/user_projects/domains/gidprd/servers/qbp-*/logs/qnb-application-log/car-qnb-application.M6.log"
| rex "\[[^\:]*\:(?&amp;lt;sessionId&amp;gt;.*)\:\:\:M6.*aggregatorID\=\'(?&amp;lt;aggId&amp;gt;[^\']*)"
| join sessionId 
    [search index=app_qnb earliest=-10m source="/user_projects/domains/gidprd/servers/qbp-*/logs/qnb-application-log/car-qnb-application.M6.log" | rex "\[[^\:]*\:(?&amp;lt;sessionId&amp;gt;[^\:]*)\:(?&amp;lt;requestId&amp;gt;[^\:]*)"]
| table sessionId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was hoping i could at leats get as far as the combination of both sessionId results, but no such luck. I'm turning to you guys as I know someone out there is going to hopefully show how to do this quickly, easily and far less complicated than I am making it! Oh, and it's v6.6.4 if that helps.&lt;/P&gt;

&lt;P&gt;Help me Obi-splunk_kenobi, you're my only hope&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 14:22:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-searches-for-purpose-of-table-stats/m-p/332087#M98781</guid>
      <dc:creator>Barty</dc:creator>
      <dc:date>2018-03-06T14:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two searches for purpose of table &amp; stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-searches-for-purpose-of-table-stats/m-p/332088#M98782</link>
      <description>&lt;P&gt;Give this a try..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=our_index source="/user_projects/domains/gidprd/servers/qbp-*/logs/qnb-application-log/car-qnb-application.M6.log"
| rex "\[[^\:]*\:(?&amp;lt;sessionId&amp;gt;[^\:]*)"
| rex "\[[^\:]*\:(.*)\:\:\:M6.*aggregatorID\=\'(?&amp;lt;aggId&amp;gt;[^\']*)"
| rex "\[[^\:]*\:([^\:]*)\:(?&amp;lt;requestId&amp;gt;[^\:]*)" 
| stats values(aggId) as aggId dc(requestId) as counter by sessionId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Mar 2018 15:34:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-searches-for-purpose-of-table-stats/m-p/332088#M98782</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-03-06T15:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two searches for purpose of table &amp; stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-searches-for-purpose-of-table-stats/m-p/332089#M98783</link>
      <description>&lt;P&gt;Seems to have worked a charm! Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 08:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-searches-for-purpose-of-table-stats/m-p/332089#M98783</guid>
      <dc:creator>Barty</dc:creator>
      <dc:date>2018-03-07T08:41:35Z</dc:date>
    </item>
  </channel>
</rss>

