<?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 isn't this query working for me (using stats, eval, count) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443246#M125765</link>
    <description>&lt;P&gt;Renaming the variable allowed it to work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;message.meta.service=foo
| rename message.meta.route as route
 | stats 
     count(eval(route="/foobar/publish")) as publishes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 Jun 2019 21:04:31 GMT</pubDate>
    <dc:creator>gkolstad</dc:creator>
    <dc:date>2019-06-26T21:04:31Z</dc:date>
    <item>
      <title>Why isn't this query working for me (using stats, eval, count)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443245#M125764</link>
      <description>&lt;P&gt;The following query is not working for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;message.meta.service=foo
| stats 
    count(eval(message.meta.route="/foobar/publish")) as publishes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It always results in &lt;CODE&gt;publishes&lt;/CODE&gt; being &lt;CODE&gt;0&lt;/CODE&gt;, when it should be greater than 0 (e.g., 55).&lt;/P&gt;

&lt;P&gt;Doing a query of just: &lt;BR /&gt;
    &lt;CODE&gt;message.meta.route="/foobar/publish"&lt;/CODE&gt; &lt;BR /&gt;
returns multiple events (e.g., 55), but wh&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 20:18:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443245#M125764</guid>
      <dc:creator>rbednark</dc:creator>
      <dc:date>2019-06-26T20:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't this query working for me (using stats, eval, count)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443246#M125765</link>
      <description>&lt;P&gt;Renaming the variable allowed it to work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;message.meta.service=foo
| rename message.meta.route as route
 | stats 
     count(eval(route="/foobar/publish")) as publishes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jun 2019 21:04:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443246#M125765</guid>
      <dc:creator>gkolstad</dc:creator>
      <dc:date>2019-06-26T21:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't this query working for me (using stats, eval, count)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443247#M125766</link>
      <description>&lt;P&gt;Try this (fields with special characters in its name should be enclosed in single quotes when used in expressions of eval/where)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; message.meta.service=foo
 | stats 
     count(eval('message.meta.route'="/foobar/publish")) as publishes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jun 2019 21:04:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443247#M125766</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-06-26T21:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't this query working for me (using stats, eval, count)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443248#M125767</link>
      <description>&lt;P&gt;Working with &lt;CODE&gt;rbednark&lt;/CODE&gt; we discovered that renaming the variable allowed the eval and count to work as expected.&lt;BR /&gt;
Can't use &lt;CODE&gt;.&lt;/CODE&gt; in an eval comparison I guess?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;message.meta.service=foo
| rename message.meta.route as route
| stats 
count(eval(route="/foobar/publish")) as publishes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jun 2019 21:06:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443248#M125767</guid>
      <dc:creator>gkolstad</dc:creator>
      <dc:date>2019-06-26T21:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't this query working for me (using stats, eval, count)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443249#M125768</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=YouShouldAlwaysSpecifyAnIndex AND sourcetype=AndSourcetypeToo AND message.meta.service=foo
| stats count(eval('message.meta.route'="/foobar/publish")) AS publishes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You must encapsulate the field name in single-quotes because it contains periods.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2019 19:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-isn-t-this-query-working-for-me-using-stats-eval-count/m-p/443249#M125768</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-29T19:30:36Z</dc:date>
    </item>
  </channel>
</rss>

