<?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 get a percentage out of 2 queries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403353#M116716</link>
    <description>&lt;P&gt;@kvanwagoner Try this -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; "A PUT was made to OpenAAA API - Status: *" | rex "Status: (?&amp;lt;status&amp;gt;\w+)" | spath AppID 
 | search AppID=200296 Environment=prod | timechart count(eval(status="OK")) as success, count(eval(status="1")) as failures| bin span=7d _time 
 | stats avg(success) as S, avg(failures) as F| eval pct=( F * 100 ) / S
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 04 Jun 2019 20:31:39 GMT</pubDate>
    <dc:creator>Vijeta</dc:creator>
    <dc:date>2019-06-04T20:31:39Z</dc:date>
    <item>
      <title>How to get a percentage out of 2 queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403349#M116712</link>
      <description>&lt;P&gt;I've got 2 search queries that are working for me (Thanks to @harshpatel)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query #1&lt;/STRONG&gt; returns the average # of successes over the last 7 Days.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"A PUT was made to OpenAAA API - Status: OK" | spath AppID | search AppID=200296 Environment=prod | timechart count by Environment | bin span=7d _time | stats avg(prod)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Query #2&lt;/STRONG&gt; returns the average # of failures over the last 7 Days.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"A PUT was made to OpenAAA API - Status: 1" | spath AppID | search AppID=200296 Environment=prod | timechart count by Environment | bin span=7d _time | stats avg(prod)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I find out the percentage of failures based on these 2 queries?  AVG # of Failures divided by AVG # of Successes &lt;/P&gt;

&lt;P&gt;Example.  100 success and 50 failures .... Percentage of Failures would be 50%)&lt;/P&gt;

&lt;P&gt;Any help will be greatly appreciated!&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 11:26:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403349#M116712</guid>
      <dc:creator>kvanwagoner</dc:creator>
      <dc:date>2019-06-04T11:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a percentage out of 2 queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403350#M116713</link>
      <description>&lt;P&gt;Try combining the two  queries.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"A PUT was made to OpenAAA API - Status: *" | rex "Status: (?&amp;lt;status&amp;gt;\w+)" | spath AppID 
| search AppID=200296 Environment=prod | timechart count by Environment | bin span=7d _time 
| stats count, count(eval(status="OK")) as successes, count(eval(status=1)) as failures | eval pct=(failures*100)/successes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 13:42:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403350#M116713</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-04T13:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a percentage out of 2 queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403351#M116714</link>
      <description>&lt;P&gt;Thanks @richgalloway &lt;BR /&gt;
This is returning &lt;BR /&gt;
count=08&lt;BR /&gt;
failures=0&lt;BR /&gt;&lt;BR /&gt;
successes=0&lt;BR /&gt;
The two separate queries return 359 success and 7 failures.  Which would be around 1.9%&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 15:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403351#M116714</guid>
      <dc:creator>kvanwagoner</dc:creator>
      <dc:date>2019-06-04T15:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a percentage out of 2 queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403352#M116715</link>
      <description>&lt;P&gt;@harshpatel any ideas on this?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 18:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403352#M116715</guid>
      <dc:creator>kvanwagoner</dc:creator>
      <dc:date>2019-06-04T18:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a percentage out of 2 queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403353#M116716</link>
      <description>&lt;P&gt;@kvanwagoner Try this -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; "A PUT was made to OpenAAA API - Status: *" | rex "Status: (?&amp;lt;status&amp;gt;\w+)" | spath AppID 
 | search AppID=200296 Environment=prod | timechart count(eval(status="OK")) as success, count(eval(status="1")) as failures| bin span=7d _time 
 | stats avg(success) as S, avg(failures) as F| eval pct=( F * 100 ) / S
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 20:31:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403353#M116716</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-06-04T20:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a percentage out of 2 queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403354#M116717</link>
      <description>&lt;P&gt;Thanks @Vijeta .  That works great! &lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2019 12:47:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-percentage-out-of-2-queries/m-p/403354#M116717</guid>
      <dc:creator>kvanwagoner</dc:creator>
      <dc:date>2019-06-05T12:47:49Z</dc:date>
    </item>
  </channel>
</rss>

