<?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 statement not working... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107271#M27890</link>
    <description>&lt;P&gt;You would be &lt;EM&gt;much&lt;/EM&gt; better off running:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sandbox sourcetype=as-cdr 
| stats 
    count as numCalls
    count(eval(Termination_Cause=="016")) as numCallsSuccessful
| eval callSuccRate = numCallsSuccessful/numCalls
| table callSuccRate
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If your data set is very large, the subsearch will probably run into time limits. With Splunk it is generally a good idea to search the data set and retrieve data just once if possible, rather than running multiple searches or subsearches (particularly if they retrieve the same data or a subset of data).&lt;/P&gt;</description>
    <pubDate>Tue, 21 Dec 2010 10:14:50 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2010-12-21T10:14:50Z</dc:date>
    <item>
      <title>Eval statement not working...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107269#M27888</link>
      <description>&lt;P&gt;For some reason the following isn't working:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="sandbox" sourcetype="as-cdr" |stats count AS numCalls
|append [search index="sandbox" sourcetype="as-cdr" Termination_Cause="016"|stats count AS numCallsSuccessful]
|eval callSuccRate=numCallsSuccessful/numCalls
|table callSuccRate
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When running the searches separately I get 134 for numCalls, and 90 for numCallsSuccessful. However when I try to evaluate them and print it to a table I get no results found. Can anyone shed some light on what I'm doing wrong?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2010 09:25:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107269#M27888</guid>
      <dc:creator>msarro</dc:creator>
      <dc:date>2010-12-21T09:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Eval statement not working...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107270#M27889</link>
      <description>&lt;P&gt;I should note I have a few reports I need to generate that use basically this same syntax. Its simple; and I can't quite figure out why its failing. Strangely I have a more complicated search that is working just fine.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2010 09:44:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107270#M27889</guid>
      <dc:creator>msarro</dc:creator>
      <dc:date>2010-12-21T09:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Eval statement not working...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107271#M27890</link>
      <description>&lt;P&gt;You would be &lt;EM&gt;much&lt;/EM&gt; better off running:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sandbox sourcetype=as-cdr 
| stats 
    count as numCalls
    count(eval(Termination_Cause=="016")) as numCallsSuccessful
| eval callSuccRate = numCallsSuccessful/numCalls
| table callSuccRate
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If your data set is very large, the subsearch will probably run into time limits. With Splunk it is generally a good idea to search the data set and retrieve data just once if possible, rather than running multiple searches or subsearches (particularly if they retrieve the same data or a subset of data).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2010 10:14:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107271#M27890</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-12-21T10:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Eval statement not working...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107272#M27891</link>
      <description>&lt;P&gt;That actually fixed my issue, AND its a good pointer. Now I have to go and revisit some prior items I had done before &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2010 10:41:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107272#M27891</guid>
      <dc:creator>msarro</dc:creator>
      <dc:date>2010-12-21T10:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Eval statement not working...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107273#M27892</link>
      <description>&lt;P&gt;Hi splunkers! &lt;/P&gt;

&lt;P&gt;I have to filter all the results of this field since 04/12/2018 until 04/12/2019 but when I do this search, it doesn't work , it comes results since from  2006!&lt;/P&gt;

&lt;P&gt;I have tried using date time picker , but its still not working too.&lt;/P&gt;

&lt;P&gt;How am I supposed to search? Do I have to use eval or another specific command?&lt;/P&gt;

&lt;P&gt;Thank you friends.&lt;/P&gt;

&lt;P&gt;![a&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 20:00:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107273#M27892</guid>
      <dc:creator>lucasdc</dc:creator>
      <dc:date>2019-04-12T20:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Eval statement not working...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107274#M27893</link>
      <description>&lt;P&gt;Hi splunkers!&lt;/P&gt;

&lt;P&gt;I have to filter all the results of this field since 04/12/2018 until 04/12/2019 but when I do this search, it doesn't work , it comes results since from 2006!&lt;/P&gt;

&lt;P&gt;I have tried using date time picker , but its still not working too.&lt;/P&gt;

&lt;P&gt;How am I supposed to search? Do I have to use eval or another specific command?&lt;/P&gt;

&lt;P&gt;Query:&lt;/P&gt;

&lt;P&gt;index="db_archer2" earliest=-8760h latest=now()&lt;BR /&gt;
| fields "Nome do Projeto"&lt;BR /&gt;
| dedup "Nome do Projeto"&lt;BR /&gt;
| eval Hoje= now()&lt;BR /&gt;
| eval Hoje= now()-8760&lt;BR /&gt;
| convert ctime(Hoje) ctime()&lt;BR /&gt;
| stats dc&lt;/P&gt;

&lt;P&gt;PS: The result was supposed to be 25 events.&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:46:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-statement-not-working/m-p/107274#M27893</guid>
      <dc:creator>lucasdc</dc:creator>
      <dc:date>2019-04-15T13:46:26Z</dc:date>
    </item>
  </channel>
</rss>

