<?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: eval percentage issue in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195533#M56375</link>
    <description>&lt;P&gt;How do you get the value of success? With a append statement u wont be able to combine it to single event right?&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2014 20:32:22 GMT</pubDate>
    <dc:creator>linu1988</dc:creator>
    <dc:date>2014-01-03T20:32:22Z</dc:date>
    <item>
      <title>eval percentage issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195530#M56372</link>
      <description>&lt;P&gt;I am trying to create an error percent tracker, but I cant get the eval command to generate a number. I have tried several search strings, these two seem to be the closest to success.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="java" host="*tkn*" proxy\/listing | stats count as total | append [search index="java" host="*tkn*" proxy\/listing eventtype="java_exception*" OR eventtype="nix_errors" | stats count as error] | eval error_percentage=100*round(error/success,4) | fields error_percentage,error,total | rangemap field=error_percentage low=0-5 elevated=5-10 severe=10-100 default=0

index="java" host="*tkn*" proxy\/listing | stats count as total | search eventtype="java_exception*" OR eventtype="nix_errors" | stats count as error | eval error_percentage=100*round(error/success,4) | fields error_percentage | rangemap field=error_percentage low=0-5 elevated=5-10 severe=10-100 default=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jan 2014 18:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195530#M56372</guid>
      <dc:creator>kelambert</dc:creator>
      <dc:date>2014-01-03T18:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: eval percentage issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195531#M56373</link>
      <description>&lt;P&gt;Try following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="java" host="tkn" proxy/listing | eval hasError=if(eventtype="java_exception" OR eventtype="nix_errors","yes","no") | stats count(eval(hasError="yes")) as error, count as total | eval error_percentage=round(error*100/total,4) | rangemap field=error_percentage low=0-5 elevated=5-10 severe=10-100 default=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:23:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195531#M56373</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-01-03T20:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: eval percentage issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195532#M56374</link>
      <description>&lt;P&gt;I'm guessing you want to know what percentage of events from your base search have one of those two eventtypes?&lt;/P&gt;

&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | stats count as total count(eval(match(eventtype, "^java_exception") OR eventtype="nix_errors")) as errors | eval error_percentage=100*round(errors/total,4)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you like, you can pull the definition of what constitutes an error out of the stats, to get something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eval error=if(match(eventtype, "^java_exception") OR eventtype="nix_errors",1,0) | stats count as total sum(error) as errors | eval error_percentage=100*round(errors/total,4)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:30:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195532#M56374</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-01-03T20:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: eval percentage issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195533#M56375</link>
      <description>&lt;P&gt;How do you get the value of success? With a append statement u wont be able to combine it to single event right?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:32:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195533#M56375</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-03T20:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: eval percentage issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195534#M56376</link>
      <description>&lt;P&gt;Success was a typo from the opposite query, was suppose to be total. The below answers all worked perfectly, thank you for the help&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:46:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-percentage-issue/m-p/195534#M56376</guid>
      <dc:creator>kelambert</dc:creator>
      <dc:date>2014-01-03T20:46:31Z</dc:date>
    </item>
  </channel>
</rss>

