<?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 merge and make one result out of multiple results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289763#M87663</link>
    <description>&lt;P&gt;@niketnilay thank you for the response.&lt;/P&gt;

&lt;P&gt;I was able to get the answer by using the below search, your answers helped me get there.&lt;/P&gt;

&lt;P&gt;index=cap host=prod |&lt;BR /&gt;
eval product=case(URI like "/credit/%","Credit",&lt;BR /&gt;
URI like "/credit/%","Transactions",1==1, "Others")| &lt;BR /&gt;
stats count by product&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2018 18:09:23 GMT</pubDate>
    <dc:creator>raviteja029</dc:creator>
    <dc:date>2018-01-10T18:09:23Z</dc:date>
    <item>
      <title>How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289753#M87653</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;

&lt;P&gt;I have a result which displays common starting URI. but I have to combine it to one and have the result, how can I do it ?&lt;/P&gt;

&lt;P&gt;Result - &lt;/P&gt;

&lt;P&gt;/credit/company/23532525 .   10&lt;BR /&gt;
/credit/company/34532523 .   30&lt;BR /&gt;
/credit/product/23235225 .      40&lt;/P&gt;

&lt;P&gt;I need something like &lt;/P&gt;

&lt;P&gt;/credit/                    80&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 20:24:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289753#M87653</guid>
      <dc:creator>raviteja029</dc:creator>
      <dc:date>2018-01-05T20:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289754#M87654</link>
      <description>&lt;P&gt;Updated to remove the limitation of just &lt;CODE&gt;Credit&lt;/CODE&gt; events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cap host=prod
| rex field=URI "^(?&amp;lt;firstsegment&amp;gt;/[^/]+)/"
| stats count BY firstsegment
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jan 2018 20:27:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289754#M87654</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-05T20:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289755#M87655</link>
      <description>&lt;P&gt;Thank you for the reply.&lt;/P&gt;

&lt;P&gt;So after I did the below search &lt;/P&gt;

&lt;P&gt;index=cap host=prod SERVICE="Credit" | eval product=case( URI="&lt;EM&gt;/credit/&lt;/EM&gt;" ,"Credit", 1==1,URI ) | stats count as total by product&lt;/P&gt;

&lt;P&gt;I got &lt;/P&gt;

&lt;P&gt;/credit/company/23532525 . 10&lt;BR /&gt;
/credit/company/34532523 . 30&lt;BR /&gt;
/credit/product/23235225 . 40&lt;/P&gt;

&lt;P&gt;I need that to be &lt;/P&gt;

&lt;P&gt;/credit/ .  80&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 20:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289755#M87655</guid>
      <dc:creator>raviteja029</dc:creator>
      <dc:date>2018-01-05T20:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289756#M87656</link>
      <description>&lt;P&gt;Edited to take that into consideration.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 20:38:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289756#M87656</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-05T20:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289757#M87657</link>
      <description>&lt;P&gt;Thanks for the reply, this works!&lt;/P&gt;

&lt;P&gt;How can I add multiple URI's like credit, trans, bank.... ?&lt;/P&gt;

&lt;P&gt;where I am looking forward an output like below,&lt;/P&gt;

&lt;P&gt;/credit/ . 80&lt;BR /&gt;
/transaction/ .  100&lt;BR /&gt;
/Bank/ .  50&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 08:09:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289757#M87657</guid>
      <dc:creator>raviteja029</dc:creator>
      <dc:date>2018-01-07T08:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289758#M87658</link>
      <description>&lt;P&gt;&lt;STRONG&gt;[UPDATED]&lt;/STRONG&gt;&lt;BR /&gt;
Modified mock query based on updated details.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;@raviteja029, can you post some sample URIs from your raw events with credit transaction and bank? Do they actually start like the example in your question i.e. &lt;CODE&gt;/credit/...&lt;/CODE&gt; or is there something prefixing i.e.&lt;CODE&gt;.../credit/...&lt;/CODE&gt;? While posting the code and sample data make sure you use the code button &lt;CODE&gt;(101010)&lt;/CODE&gt; so that special characters like asterisk &lt;CODE&gt;(*)&lt;/CODE&gt; do not escape.&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search based on the sample data in the question. Pipes from &lt;CODE&gt;makeresults&lt;/CODE&gt; till &lt;CODE&gt;mvexpand&lt;/CODE&gt; mimic the sample data.&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;eval&lt;/CODE&gt; command uses &lt;CODE&gt;replace()&lt;/CODE&gt; function to retain only the first part of URI and then stats count by URI gives the required result you are looking for.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval URI="https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/23532525;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/23532525;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/23532525;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/23532525;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/34532523;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/23532525;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/product/23235225;https://api-sandbox..com/credit/company/23532525;https://api-sandbox..com/transaction/company/34532523;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/company/23532525;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/company/23532525;https://api-sandbox..com/transaction/company/34532523;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/company/34532523;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/company/23532525;https://api-sandbox..com/transaction/company/34532523;https://api-sandbox..com/transaction/company/34532523;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/company/34532523;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/company/23532525;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/product/23235225;https://api-sandbox..com/transaction/company/23532525;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/company/23532525;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/company/23532525;https://api-sandbox..com/bank/company/34532523;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/company/34532523;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/company/34532523;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/company/34532523;https://api-sandbox..com/bank/product/23235225;https://api-sandbox..com/bank/company/23532525"
 | makemv URI delim=";" 
 | mvexpand URI
 | eval URI=replace(URI,"^(.*).com\/([^\/]+)?+\/(.*)","\2")
 | stats count by URI
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: You can try the following command in your case (if it does not work post actual URI values as per your events as requested):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=cap host=prod SERVICE="Credit" 
| eval URI=replace(URI,"^(.*).com\/([^\/]+)?+\/(.*)","\2")
| stats count by URI
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Jan 2018 16:37:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289758#M87658</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-01-07T16:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289759#M87659</link>
      <description>&lt;P&gt;@aniketnilay Thank you for your response.&lt;/P&gt;

&lt;P&gt;My actual query should go search the 3 URI's in the entire set of results which are&lt;BR /&gt;
Credit, Bank, Transactions in the URI and the URI's of each something looks like below,&lt;/P&gt;

&lt;P&gt;Bank  - &lt;A href="https://api-sandbox.****.com/bank/deposits/account-applications"&gt;https://api-sandbox.****.com/bank/deposits/account-applications&lt;/A&gt;&lt;BR /&gt;
             - &lt;A href="https://api-sandbox.****.com/bank/deposits/details"&gt;https://api-sandbox.****.com/bank/deposits/details&lt;/A&gt;&lt;BR /&gt;
             -   &lt;A href="https://api-sandbox.****.com/bank/application/"&gt;https://api-sandbox.****.com/bank/application/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Credit -   &lt;A href="https://api-sandbox.****.com/credit/products?li/34141"&gt;https://api-sandbox.****.com/credit/products?li/34141&lt;/A&gt;&lt;BR /&gt;
             -    &lt;A href="https://api-sandbox.****.com/credit/business/43414"&gt;https://api-sandbox.****.com/credit/business/43414&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;here I want to get details where how many calls were made for each API for credit/Bank/Transactions and compare in once single graph&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 16:55:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289759#M87659</guid>
      <dc:creator>raviteja029</dc:creator>
      <dc:date>2018-01-07T16:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289760#M87660</link>
      <description>&lt;P&gt;I think you just need to not filter for just the &lt;CODE&gt;Credit&lt;/CODE&gt; events.  I've updated my answer to reflect this.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 17:12:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289760#M87660</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-07T17:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289761#M87661</link>
      <description>&lt;P&gt;With the updated search it's not showing any result. &lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 17:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289761#M87661</guid>
      <dc:creator>raviteja029</dc:creator>
      <dc:date>2018-01-07T17:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289762#M87662</link>
      <description>&lt;P&gt;@raviteja029, can you try the updated answer?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 18:00:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289762#M87662</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-01-10T18:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and make one result out of multiple results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289763#M87663</link>
      <description>&lt;P&gt;@niketnilay thank you for the response.&lt;/P&gt;

&lt;P&gt;I was able to get the answer by using the below search, your answers helped me get there.&lt;/P&gt;

&lt;P&gt;index=cap host=prod |&lt;BR /&gt;
eval product=case(URI like "/credit/%","Credit",&lt;BR /&gt;
URI like "/credit/%","Transactions",1==1, "Others")| &lt;BR /&gt;
stats count by product&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 18:09:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-make-one-result-out-of-multiple-results/m-p/289763#M87663</guid>
      <dc:creator>raviteja029</dc:creator>
      <dc:date>2018-01-10T18:09:23Z</dc:date>
    </item>
  </channel>
</rss>

