<?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: Search query and calcs for dashboard presentation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360806#M160656</link>
    <description>&lt;P&gt;I would try like this. No subsearch/append.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="fire-ext_prd_app" securityLevel=1 (isProctor=true event=firstItemLoadTime  isPractice=false) OR ( event="ProctorCache ypass") 
| eval Failed=if(event="ProctorCache ypass",1,0) 
| eval Success=abs(1-Failed)
| stats  sum(Success) as Success sum(Failed) as Failed
| eval "Success%"=Success*100/(Success-Failed)
| eval "Failed%"=Failed*100/(Success-Failed)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Jun 2017 03:21:47 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-06-22T03:21:47Z</dc:date>
    <item>
      <title>Search query and calcs for dashboard presentation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360804#M160654</link>
      <description>&lt;P&gt;I need to be able to query two values called Success and Failed (different criteria for each), and then do some quick calcs to determine the % of Success and % of Failed and display all 4 values in a dashboard.  I've created the query below which is successful at pulling Success and Failed values, but I can't figure out how to calc the % values and display them.  I need to output to be &lt;/P&gt;

&lt;P&gt;Number Column         %  Column&lt;BR /&gt;
Success                         Success %&lt;BR /&gt;
Failed                            Failed %&lt;/P&gt;

&lt;P&gt;sourcetype="fire-ext_prd_app"   isProctor=true  event=firstItemLoadTime  securityLevel=1  isPractice=false | stats count(event) as Success | append [search sourcetype="fire-ext_prd_app" event="ProctorCache &lt;EM&gt;ypass&lt;/EM&gt;" securityLevel=1  | stats count(event) as Failed] | eval SuccessPercent=Success/( Success + Failed ) | table Success, Failed, x&lt;/P&gt;

&lt;P&gt;The first part works fine, but the tail end needs help:&lt;BR /&gt;
 eval SuccessPercent=Success/( Success + Failed ) | table Success, Failed, x&lt;/P&gt;

&lt;P&gt;I need to be able add the second calculation for FailedPercent=Failed/( Success + Failed ), not sure how to add that to the string.  And I need to be able to display the results in the format shown above.&lt;/P&gt;

&lt;P&gt;Any guidance would be appreciated.  This can't be hard but it's somehow eluding me at this point.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:33:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360804#M160654</guid>
      <dc:creator>brimartens</dc:creator>
      <dc:date>2020-09-29T14:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Search query and calcs for dashboard presentation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360805#M160655</link>
      <description>&lt;P&gt;Try adding this after your append search. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  |eval Status=if(isnotnull(Success),"Success","Failed")
    |eval StatusCount=coalesce(Success,Failed)
    |eventstats sum(StatusCount) as total
    |eval StatusPerc=StatusCount/total*100
|fields - Success - Failed
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2017 23:52:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360805#M160655</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-06-21T23:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search query and calcs for dashboard presentation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360806#M160656</link>
      <description>&lt;P&gt;I would try like this. No subsearch/append.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="fire-ext_prd_app" securityLevel=1 (isProctor=true event=firstItemLoadTime  isPractice=false) OR ( event="ProctorCache ypass") 
| eval Failed=if(event="ProctorCache ypass",1,0) 
| eval Success=abs(1-Failed)
| stats  sum(Success) as Success sum(Failed) as Failed
| eval "Success%"=Success*100/(Success-Failed)
| eval "Failed%"=Failed*100/(Success-Failed)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2017 03:21:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360806#M160656</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-22T03:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search query and calcs for dashboard presentation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360807#M160657</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=YesYouShouldBeSpecifyingAnIndex sourcetype="fire-ext_prd_app" isProctor=true event="firstItemLoadTime" securityLevel=1 isPractice=false) OR (index=IMeanItYouShouldBeSpecifyingAnIndex sourcetype="fire-ext_prd_app" event="ProctorCache ypass" securityLevel=1)
| stats count AS Total count(eval(event="ProctorCache ypass")) AS Failed | eval Success = Total - Failed
| eval SuccessPercent=100 * Success / Total
| eval FailedPercent=100 * Failed / Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Jun 2017 09:34:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-and-calcs-for-dashboard-presentation/m-p/360807#M160657</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-23T09:34:12Z</dc:date>
    </item>
  </channel>
</rss>

