<?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 do I use the eval command to calculate error rates and show them as percentages? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441865#M125489</link>
    <description>&lt;P&gt;hmm.. I still dont understand how to get them. pls help!!&lt;/P&gt;

&lt;P&gt;For example: how would I get total_logins?&lt;/P&gt;</description>
    <pubDate>Tue, 23 Oct 2018 19:11:49 GMT</pubDate>
    <dc:creator>moizmmz</dc:creator>
    <dc:date>2018-10-23T19:11:49Z</dc:date>
    <item>
      <title>How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441860#M125484</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am creating a dashboard in which I am displaying total logins, successful logins, failed logins, error rates for each failed login, and percentages of failed logins.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Where:&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;Total Logins   say count is 1000&lt;BR /&gt;
Successful logins where status=200  say count=800&lt;BR /&gt;
Failed logins is when status!=200   say count = 200&lt;BR /&gt;&lt;BR /&gt;
i.e., when status=401(say count = 100) or 204 (say count = 50) or 404 (say count = 50)&lt;/P&gt;

&lt;P&gt;I first need to calculate the error rate for each failed login. So say error rate for status =401. I know the math i.e., 50/1000 where 50 is count for 401 and 100 is the total logins. But, I don't know how to use the eval command very well. Pls help!!&lt;/P&gt;

&lt;P&gt;Also, I need to calculate the percentage of failed logins i.e., (200/1000)*100. Again, need help with the eval command. Pls help!!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 16:57:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441860#M125484</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-23T16:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441861#M125485</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;eval Error_Rate = (error_count/login_count)*100
eval Percent_Failed = (failed_count/login_count)*100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:30:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441861#M125485</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-10-23T17:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441862#M125486</link>
      <description>&lt;P&gt;Its not working. Problem is that I cant use count in eval. &lt;/P&gt;

&lt;P&gt;For example: Here Total_logins is count(status)&lt;/P&gt;

&lt;P&gt;so I wrote:  eval Total_logins=count(status), but it returns an error. Pls help!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 18:33:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441862#M125486</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-23T18:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441863#M125487</link>
      <description>&lt;P&gt;You need to use stats in order to get your counts. I assumed you already had those counts. &lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 18:38:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441863#M125487</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-10-23T18:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441864#M125488</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;P&gt;yourquery| streamstats count(status) as Total|stats count(eval(Status!=200)) as Error by Status| eval Error_Rate = (Error/Total)*100&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441864#M125488</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-23T19:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441865#M125489</link>
      <description>&lt;P&gt;hmm.. I still dont understand how to get them. pls help!!&lt;/P&gt;

&lt;P&gt;For example: how would I get total_logins?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:11:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441865#M125489</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-23T19:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441866#M125490</link>
      <description>&lt;P&gt;@moizmmz  what does your event look like and what are field names for status? Each event means a login?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:22:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441866#M125490</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-23T19:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441867#M125491</link>
      <description>&lt;P&gt;Here's my query:&lt;/P&gt;

&lt;P&gt;index=akamai cp=654130 login|  stats count (status)&lt;/P&gt;

&lt;P&gt;This basically gives me the total logins.&lt;/P&gt;

&lt;P&gt;Next, status=200 gives me successful logins and status!=200 gives me failed logins. &lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:31:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441867#M125491</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-23T19:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441868#M125492</link>
      <description>&lt;P&gt;This doesn't work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Help pls!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441868#M125492</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-23T19:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441869#M125493</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=akamai cp=654130 login| eventstats count (status) as Total|where status!=200| stats count(status) as Error, values(Total) as Total by status| eval error_rate= Error/Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:52:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441869#M125493</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-23T19:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441870#M125494</link>
      <description>&lt;P&gt;Well... the result displays the status, total_logins and number of errors. However, I want to display only the error rate and the status&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 20:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441870#M125494</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-23T20:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441871#M125495</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=akamai cp=654130 login 
| eventstats count (status) as Total 
| where status!=200 
| stats count(status) as Error, values(Total) as Total by status 
| eval error_rate= Error/Total 
| fields error_rate status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Oct 2018 20:19:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441871#M125495</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-10-23T20:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441872#M125496</link>
      <description>&lt;P&gt;You can add  |fields error_rate status  at the end of query&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 20:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441872#M125496</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-23T20:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441873#M125497</link>
      <description>&lt;P&gt;But there's no value for error_rate. It doesn't seem to be calculating it. I'm sorry for all the trouble &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 20:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441873#M125497</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-23T20:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441874#M125498</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Try this:

index=akamai cp=654130 login 
| eval error_ind = if(status=200,0,1) 
| stats count(status) as Total, sum(error_ind) as Errors by status 
| eval error_rate= (Errors/Total)*100
| fields error_rate status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Oct 2018 11:57:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441874#M125498</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-10-24T11:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441875#M125499</link>
      <description>&lt;P&gt;Check if this helps.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your search&lt;/CODE&gt; &lt;BR /&gt;
| stats count(eval(status="200")) as success count(eval(status!=200) as failed count(eval(status) as total_logon&lt;BR /&gt;&lt;BR /&gt;
| eval success_rate =(success/total_logon)*100 , failure_rate=(failed/total_logon)*100&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:44:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441875#M125499</guid>
      <dc:creator>CryoHydra</dc:creator>
      <dc:date>2020-09-29T21:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441876#M125500</link>
      <description>&lt;P&gt;@moizmmz did this help you at all?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 16:57:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441876#M125500</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-10-25T16:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441877#M125501</link>
      <description>&lt;P&gt;I just ran this and it worked perfectly!!'&lt;/P&gt;

&lt;P&gt;Marry me &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 16:58:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441877#M125501</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-25T16:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441878#M125502</link>
      <description>&lt;P&gt;great!!  I'll convert this to an answer then you can accept it. &lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 17:03:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441878#M125502</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-10-25T17:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the eval command to calculate error rates and show them as percentages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441879#M125503</link>
      <description>&lt;P&gt;Nope it gives an error &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 17:23:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-the-eval-command-to-calculate-error-rates-and-show/m-p/441879#M125503</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2018-10-25T17:23:22Z</dc:date>
    </item>
  </channel>
</rss>

