<?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: Why is my eval calculation not displaying in table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258885#M77585</link>
    <description>&lt;P&gt;When you use &lt;CODE&gt;append&lt;/CODE&gt; events get added to the end. So in your case, you have events on the top with the &lt;CODE&gt;total&lt;/CODE&gt; fields and events at the bottom have the &lt;CODE&gt;alltransactions&lt;/CODE&gt; field. Hence you math doesn't work. Its either &lt;CODE&gt;total/null&lt;/CODE&gt; OR &lt;CODE&gt;null/alltransactions&lt;/CODE&gt;, both generating errors. To fix this, you should get rid of the &lt;CODE&gt;append&lt;/CODE&gt; subsearch. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(base search for error events) OR (base search for success events) | eval errors=if(isnotnull(errorType), 1, 0) | eval success=if(isnotnull(success), 1, 0) | timechart span=1h sum(errors) as total sum(success) as alltransactions | eval failure_rate=round(total/alltransactions*100,1) | | eval _time=strftime('_time', "%A, %B %e, %Y %I:%M %p") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Nov 2016 22:11:37 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-11-30T22:11:37Z</dc:date>
    <item>
      <title>Why is my eval calculation not displaying in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258884#M77584</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I am trying to display a calculation for the failure rate when taking into consideration the volume of all transactions. For some reason the values for the failure_rate are not appearing in my results. I am not able to find the mistake in the search..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search...
| timechart span=1h count(errorType) as total 
| eval "Date/Time"=strftime('_time', "%A, %B %e, %Y %I:%M %p") 
| append 
    [ base search...
    | timechart span=1h count(success) as alltransactions 
    | eval "Date/Time"=strftime('_time', "%A, %B %e, %Y %I:%M %p")] | eval failure_rate=round(total/alltransactions*100,1) | stats values(failure_rate) as failure_rate values(alltransactions) as alltransactions values(total) as total by "Date/Time" | table "Date/Time" failure_rate alltransactions total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 22:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258884#M77584</guid>
      <dc:creator>demkic</dc:creator>
      <dc:date>2016-11-30T22:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my eval calculation not displaying in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258885#M77585</link>
      <description>&lt;P&gt;When you use &lt;CODE&gt;append&lt;/CODE&gt; events get added to the end. So in your case, you have events on the top with the &lt;CODE&gt;total&lt;/CODE&gt; fields and events at the bottom have the &lt;CODE&gt;alltransactions&lt;/CODE&gt; field. Hence you math doesn't work. Its either &lt;CODE&gt;total/null&lt;/CODE&gt; OR &lt;CODE&gt;null/alltransactions&lt;/CODE&gt;, both generating errors. To fix this, you should get rid of the &lt;CODE&gt;append&lt;/CODE&gt; subsearch. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(base search for error events) OR (base search for success events) | eval errors=if(isnotnull(errorType), 1, 0) | eval success=if(isnotnull(success), 1, 0) | timechart span=1h sum(errors) as total sum(success) as alltransactions | eval failure_rate=round(total/alltransactions*100,1) | | eval _time=strftime('_time', "%A, %B %e, %Y %I:%M %p") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Nov 2016 22:11:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258885#M77585</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-11-30T22:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my eval calculation not displaying in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258886#M77586</link>
      <description>&lt;P&gt;Hi, thank you for your reply. Your above query is essentially doing the correct calculations. However, the failure rate turns out to be 100% for the entire column. The base search for error events only differs in the part that success=false while the base search for success events will include success=true. &lt;/P&gt;

&lt;P&gt;Since the two base queries only differ by that success=true or success=false part, I tried to tweak the query using only 1 base query but applying some additional commands, however now I am getting an error message... Am I on the right track?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(base search for error and success events) | stats count(eval(success="false")) as fail count(eval(success="true")) as approve| eval errors=if(isnotnull(fail), 1, 0) | eval success=if(isnotnull(approve), 1, 0) | timechart span=1h sum(fail) as total sum(approve) as alltransactions | eval failure_rate=round(total/alltransactions*100,1) | eval _time=strftime('_time', "%A, %B %e, %Y %I:%M %p") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Nov 2016 22:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258886#M77586</guid>
      <dc:creator>demkic</dc:creator>
      <dc:date>2016-11-30T22:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my eval calculation not displaying in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258887#M77587</link>
      <description>&lt;P&gt;Actually, I think I got it: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(base query that includes failed and approved transactions) 
| timechart span=1h count(eval(errorType="approved")) as approvals count(eval(errorType)) as AllErrors count(eval(event="transactionCompleted")) as CompletedTransactions 
| eval Failures=AllErrors-approvals 
| eventstats sum(CompletedTransactions) as columntotal
| eval percent_failure=round(Failures*100/columntotal , 1)
| table _time percent_failure | eval _time=strftime('_time', "%A, %B %e, %Y %I:%M %p") | rename percent_failure as "Failure Rate", _time as "Date/Time"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Nov 2016 23:17:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258887#M77587</guid>
      <dc:creator>demkic</dc:creator>
      <dc:date>2016-11-30T23:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my eval calculation not displaying in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258888#M77588</link>
      <description>&lt;P&gt;Hi @demkic - Did the answer provided by sundareshr help steer you in the right direction towards a working solution? If yes, please don't forget to resolve this post by clicking "Accept". If no, please leave a comment with more feedback. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 22:51:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-eval-calculation-not-displaying-in-table/m-p/258888#M77588</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-12-09T22:51:49Z</dc:date>
    </item>
  </channel>
</rss>

