<?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 count valid and invalid requests at the same time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522106#M147209</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226750"&gt;@vamshiverma&lt;/a&gt;&amp;nbsp;, can you try below and see if you getting the desired results&lt;/P&gt;&lt;P&gt;index=myindex sourcetype=foo.bar.*&lt;BR /&gt;|eval type=if(DETAIL="*error*" OR DETAIL="*exception*","Fail","other")&lt;BR /&gt;|stats count(UNIQUE_ID) as Total sum(eval(status="Fail")) as Fail by sourcetype&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 21:20:29 GMT</pubDate>
    <dc:creator>Nisha18789</dc:creator>
    <dc:date>2020-09-29T21:20:29Z</dc:date>
    <item>
      <title>How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522076#M147201</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to display the total count of events and failed events count. In my case, it is determined by the field DETAIL&lt;/P&gt;&lt;P&gt;The following query does return the count by sourcetype "foo.bar.* and having error or exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;index=myindex sourcetype=foo.bar.* DETAIL ="*error*" OR DETAIL ="*exception*"| stats count(UNIQUE_ID) as Fail by sourcetype&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;Sourcetype&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;Fail&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;foo.bar.cat&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;foo.bar.dog&lt;/TD&gt;&lt;TD width="50%"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to query using the following to determine total events for individual sourcetype and the fails for the same. But, the fails are always returned as zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;index=myindex sourcetype=foo.bar*| eventstats count(UNIQUE_ID) as Total by sourcetype | search index=myindex sourcetype=foo.bar*  DETAIL ="*error*" OR DETAIL ="*exception*"|stats count(UNIQUE_ID) as Fail by src| fields sourcetype Total Fail&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Sourcetype&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Total&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Fail&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;foo.bar.cat&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;153&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;foo.bar.dog&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;128&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using subsearch for the below query, but this one doesn't even work at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;index=myindex sourcetype=foo.bar*| eventstats count(UNIQUE_ID) as Total by sourcetype | stats count(eval( DETAIL ="*error*" OR DETAIL ="*exception*")) as fail values(Total) as Total by src | fields src Total fail&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your time and support!&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:40:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522076#M147201</guid>
      <dc:creator>vamshiverma</dc:creator>
      <dc:date>2020-09-29T18:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522082#M147204</link>
      <description>&lt;P&gt;You may not need a subsearch.&amp;nbsp; Try this query.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex sourcetype=foo.bar*
| eval status=if(searchmatch(DETAIL ="*error*" OR DETAIL ="*exception*"), "Fail", "Success") 
| stats count(UNIQUE_ID) as Total, sum(eval(status="Fail")) as Fail by sourcetype
| fields sourcetype Total Fail&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522082#M147204</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-29T18:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522091#M147205</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;Thank you for the reply, I appreciate it.&lt;/P&gt;&lt;P&gt;I tried to run the same query but it is throwing &lt;FONT color="#008000"&gt;&lt;EM&gt;"&lt;SPAN&gt;Error in 'eval' command: The arguments to the 'searchmatch' function are invalid."&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasd.PNG" style="width: 837px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11039iEC78D58E122FEF3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="sasd.PNG" alt="sasd.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522091#M147205</guid>
      <dc:creator>vamshiverma</dc:creator>
      <dc:date>2020-09-29T19:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522097#M147208</link>
      <description>&lt;P&gt;Sorry about that.&amp;nbsp; Try this alternative.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex sourcetype=foo.bar*
| eval status=case(searchmatch(DETAIL ="*error*"), "Fail", searchmatch(DETAIL ="*exception*"), "Fail", 1==1, "Success") 
| stats count(UNIQUE_ID) as Total, sum(eval(status="Fail")) as Fail by sourcetype
| fields sourcetype Total Fail&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:42:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522097#M147208</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-29T20:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522106#M147209</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226750"&gt;@vamshiverma&lt;/a&gt;&amp;nbsp;, can you try below and see if you getting the desired results&lt;/P&gt;&lt;P&gt;index=myindex sourcetype=foo.bar.*&lt;BR /&gt;|eval type=if(DETAIL="*error*" OR DETAIL="*exception*","Fail","other")&lt;BR /&gt;|stats count(UNIQUE_ID) as Total sum(eval(status="Fail")) as Fail by sourcetype&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:20:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522106#M147209</guid>
      <dc:creator>Nisha18789</dc:creator>
      <dc:date>2020-09-29T21:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522158#M147225</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=myindex sourcetype=foo.bar*
| eval status=case(like(DETAIL,"%error%"),"Fail",like(DETAIL,"%exception%"),"Fail",true(), "Success") 
| stats count(UNIQUE_ID) as Total, sum(eval(status="Fail")) as Fail by sourcetype
| fields sourcetype Total Fail&lt;/LI-CODE&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226750"&gt;@vamshiverma&lt;/a&gt;&amp;nbsp;, can you please try using&amp;nbsp; above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankush&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 06:05:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522158#M147225</guid>
      <dc:creator>askkawalkar</dc:creator>
      <dc:date>2020-09-30T06:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522194#M147240</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/148093"&gt;@askkawalkar&lt;/a&gt;. It helped a lot. Awesome!&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 08:55:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522194#M147240</guid>
      <dc:creator>vamshiverma</dc:creator>
      <dc:date>2020-09-30T08:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522195#M147241</link>
      <description>&lt;P&gt;Thank you !!&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/215670"&gt;@Nisha18789&lt;/a&gt;&amp;nbsp; , it's working.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 08:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522195#M147241</guid>
      <dc:creator>vamshiverma</dc:creator>
      <dc:date>2020-09-30T08:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522196#M147242</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; &amp;nbsp;slick and smooth way to solve, thanks a lot!!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 08:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522196#M147242</guid>
      <dc:creator>vamshiverma</dc:creator>
      <dc:date>2020-09-30T08:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522198#M147243</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226750"&gt;@vamshiverma&lt;/a&gt;&amp;nbsp;, Kindly accept answer for question, which is most helpful, So that others can use it if required.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ankush&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 08:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522198#M147243</guid>
      <dc:creator>askkawalkar</dc:creator>
      <dc:date>2020-09-30T08:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to count valid and invalid requests at the same time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522253#M147262</link>
      <description>&lt;P&gt;If your problem is resolved, then please click the "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 12:56:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-valid-and-invalid-requests-at-the-same-time/m-p/522253#M147262</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-30T12:56:40Z</dc:date>
    </item>
  </channel>
</rss>

