<?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: Question about subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456466#M129046</link>
    <description>&lt;P&gt;I'm sorry I do not understand what I want to do.&lt;/P&gt;

&lt;P&gt;If only to extract&lt;BR /&gt;
(your search)&lt;BR /&gt;
|where where isnotnull(ErrorCnt)&lt;/P&gt;

&lt;P&gt;If conditional summary ex･･･&lt;BR /&gt;
|stats sum(eval(if(isnotnull(ErrorCnt), Total,0))) AS Total&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jul 2018 05:59:23 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2018-07-25T05:59:23Z</dc:date>
    <item>
      <title>Question about subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456463#M129043</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have below query and the results like below table, is there a way that only search and display total count for the Users who have error(User1, User2, User3)?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   index=aaa sourcetype=bbb |eval errorByService=case(ErrorCode=400 AND match(uri,"/service1/*"),"service1",ErrorCode=400 AND match(uri,"/service2/*"),"service2",ErrorCode=400 AND match(uri,"/service3/*"),"service3")|stats count  as ErrorCnt by User errorByService 
|appendcols [search index=aaa sourcetype=bbb |eval totalByService=case(match(uri,"/service1/*"),"service1",match(uri,"/service2/*"),"service2", match(uri,"/service3/*"),"service3")|stats count as Total by User totalByService] |eval ErrorRate=ErrorCnt/Total |fields User, errorByService, ErrorCnt, totalByService, Total, ErrorRate
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5419i55E0569B1D50B623/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 09:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456463#M129043</guid>
      <dc:creator>Min1025</dc:creator>
      <dc:date>2018-07-24T09:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Question about subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456464#M129044</link>
      <description>&lt;P&gt;It is possible with ”addcoltotals” if you add a field for calculation.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(your search)
|eval Error=if(isnull(ErrorCnt),0,1)
|addcoltotals labelfield=User label=TOTAL Error
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jul 2018 11:02:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456464#M129044</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-07-24T11:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Question about subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456465#M129045</link>
      <description>&lt;P&gt;Hi HiroshiSatoh,&lt;/P&gt;

&lt;P&gt;Thank you for your answer. Maybe there is a ambiguity for my question. My question is if it possible the User range for subsearch is only for those user who have error.&lt;/P&gt;

&lt;P&gt;In subsearch, it searched all Users' data, the results shows the "Total" for User1, User2...User8, but only User1,User2, User3 have error, I want to only search and show "Total" for User1,User2, User3 in subsearch,  is it possible?&lt;BR /&gt;
Expected results:&lt;BR /&gt;
User        errorByService  ErrorCnt    totalByService  Total   ErrorRate&lt;BR /&gt;
User1       service1               2                            service1                20  0.1&lt;BR /&gt;
User2           service1               3                            service1                24  0.125&lt;BR /&gt;
User3           service2               5                            service2                35  0.142857143&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 04:46:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456465#M129045</guid>
      <dc:creator>Min1025</dc:creator>
      <dc:date>2018-07-25T04:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question about subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456466#M129046</link>
      <description>&lt;P&gt;I'm sorry I do not understand what I want to do.&lt;/P&gt;

&lt;P&gt;If only to extract&lt;BR /&gt;
(your search)&lt;BR /&gt;
|where where isnotnull(ErrorCnt)&lt;/P&gt;

&lt;P&gt;If conditional summary ex･･･&lt;BR /&gt;
|stats sum(eval(if(isnotnull(ErrorCnt), Total,0))) AS Total&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 05:59:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-about-subsearch/m-p/456466#M129046</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-07-25T05:59:23Z</dc:date>
    </item>
  </channel>
</rss>

