<?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 Returned Results of &amp;quot;0&amp;quot; when event count &amp;gt; 0 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491040#M194186</link>
    <description>&lt;P&gt;I am writing a custom dashboard that shows the number of alerts based on severity.  The severities are Critical, High, Medium, Low and Info.  &lt;/P&gt;

&lt;P&gt;The problem in my dashboard is that for each severity the returned numbers are vastly different to the native search query (as an example, a "critical" entry I see a value of "0" when it has finished running, where a "low" entry has "600" when it has finished running.  While the dashboard is generating I see a value of "3" appear (using the critical for example) before it finishes and displays a "0".&lt;/P&gt;

&lt;P&gt;If I run my query in SPL directly, for example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype="threat" NOT [|inputlookup exclusion_ip.csv | fields src] | fields severity, src, category | where severity="critical" | stats count(severity) as count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get a returned result of "3" where the dashboard shows me "0"&lt;/P&gt;

&lt;P&gt;Doing the same thing for low,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype="threat" NOT [|inputlookup exclusion_ip.csv | fields src] | fields severity, src, category | where severity="low" | stats count(severity) as count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get a returned result of "2000", whereas the dashboard shows me "600"&lt;/P&gt;

&lt;P&gt;My dashboard uses a base search to try and optimise it (the number of events in the logs (over a 24 hour period) is around 600000 with the job taking close to 56 seconds to complete.&lt;/P&gt;

&lt;P&gt;My dashboard is written as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form theme="darK" hideFilters="true" refresh="1800"&amp;gt;
&amp;lt;label&amp;gt;Dashboard&amp;lt;/label&amp;gt;
&amp;lt;description&amp;gt;A description&amp;lt;/description&amp;gt;
&amp;lt;search id="base"&amp;gt;
&amp;lt;query&amp;gt;
  index=firewall sourcetype="threat" NOT [|inputlookup exclusion_ip.csv | fields src] | fields severity, src, category
&amp;lt;/query&amp;gt;
&amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="time_tok"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
&amp;lt;row&amp;gt;
&amp;lt;panel&amp;gt;
&amp;lt;single&amp;gt;
&amp;lt;title&amp;gt;Critical&amp;lt;/title&amp;gt;
&amp;lt;search base="base"&amp;gt;
&amp;lt;query&amp;gt;
  | where severity="critical"
  | stats count(severity) as count
&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;panel&amp;gt;
&amp;lt;single&amp;gt;
&amp;lt;title&amp;gt;High&amp;lt;/title&amp;gt;
&amp;lt;search base="base"&amp;gt;
&amp;lt;query&amp;gt;
  | where severity="high"
  | stats count(severity) as count
&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
..................

 &amp;lt;row&amp;gt;
  &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
              | search severity="critical"
              | stats count(severity) As Count by category
              | sort - Count
         &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
   &amp;lt;/table&amp;gt;
  &amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
    &amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While the counts for every other panel does return a result, the number in the panels is different to the numbers of the native search.  &lt;/P&gt;

&lt;P&gt;I suspect this is a limits thing.....................&lt;/P&gt;

&lt;P&gt;If I remove the "informational" part in my search which produced "110000" results and found that the remainder of my dashboard panels increased in number.  The returned results for example is &lt;/P&gt;

&lt;P&gt;"2" critical, &lt;BR /&gt;
"193000" high&lt;BR /&gt;
"9400" medium &lt;BR /&gt;
"1400" low&lt;BR /&gt;
"0" informational (obviously)&lt;/P&gt;

&lt;P&gt;With the "informational" part added back into the search, my dashboard numbers change to &lt;/P&gt;

&lt;P&gt;"0" critical&lt;BR /&gt;
"89000" high&lt;BR /&gt;
"6200" medium&lt;BR /&gt;
"500" low &lt;BR /&gt;
"110000" informational&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2019 08:00:57 GMT</pubDate>
    <dc:creator>willadams</dc:creator>
    <dc:date>2019-11-19T08:00:57Z</dc:date>
    <item>
      <title>Returned Results of "0" when event count &gt; 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491040#M194186</link>
      <description>&lt;P&gt;I am writing a custom dashboard that shows the number of alerts based on severity.  The severities are Critical, High, Medium, Low and Info.  &lt;/P&gt;

&lt;P&gt;The problem in my dashboard is that for each severity the returned numbers are vastly different to the native search query (as an example, a "critical" entry I see a value of "0" when it has finished running, where a "low" entry has "600" when it has finished running.  While the dashboard is generating I see a value of "3" appear (using the critical for example) before it finishes and displays a "0".&lt;/P&gt;

&lt;P&gt;If I run my query in SPL directly, for example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype="threat" NOT [|inputlookup exclusion_ip.csv | fields src] | fields severity, src, category | where severity="critical" | stats count(severity) as count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get a returned result of "3" where the dashboard shows me "0"&lt;/P&gt;

&lt;P&gt;Doing the same thing for low,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype="threat" NOT [|inputlookup exclusion_ip.csv | fields src] | fields severity, src, category | where severity="low" | stats count(severity) as count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get a returned result of "2000", whereas the dashboard shows me "600"&lt;/P&gt;

&lt;P&gt;My dashboard uses a base search to try and optimise it (the number of events in the logs (over a 24 hour period) is around 600000 with the job taking close to 56 seconds to complete.&lt;/P&gt;

&lt;P&gt;My dashboard is written as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form theme="darK" hideFilters="true" refresh="1800"&amp;gt;
&amp;lt;label&amp;gt;Dashboard&amp;lt;/label&amp;gt;
&amp;lt;description&amp;gt;A description&amp;lt;/description&amp;gt;
&amp;lt;search id="base"&amp;gt;
&amp;lt;query&amp;gt;
  index=firewall sourcetype="threat" NOT [|inputlookup exclusion_ip.csv | fields src] | fields severity, src, category
&amp;lt;/query&amp;gt;
&amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="time_tok"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
&amp;lt;row&amp;gt;
&amp;lt;panel&amp;gt;
&amp;lt;single&amp;gt;
&amp;lt;title&amp;gt;Critical&amp;lt;/title&amp;gt;
&amp;lt;search base="base"&amp;gt;
&amp;lt;query&amp;gt;
  | where severity="critical"
  | stats count(severity) as count
&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;panel&amp;gt;
&amp;lt;single&amp;gt;
&amp;lt;title&amp;gt;High&amp;lt;/title&amp;gt;
&amp;lt;search base="base"&amp;gt;
&amp;lt;query&amp;gt;
  | where severity="high"
  | stats count(severity) as count
&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;/single&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
..................

 &amp;lt;row&amp;gt;
  &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
              | search severity="critical"
              | stats count(severity) As Count by category
              | sort - Count
         &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
   &amp;lt;/table&amp;gt;
  &amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
    &amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While the counts for every other panel does return a result, the number in the panels is different to the numbers of the native search.  &lt;/P&gt;

&lt;P&gt;I suspect this is a limits thing.....................&lt;/P&gt;

&lt;P&gt;If I remove the "informational" part in my search which produced "110000" results and found that the remainder of my dashboard panels increased in number.  The returned results for example is &lt;/P&gt;

&lt;P&gt;"2" critical, &lt;BR /&gt;
"193000" high&lt;BR /&gt;
"9400" medium &lt;BR /&gt;
"1400" low&lt;BR /&gt;
"0" informational (obviously)&lt;/P&gt;

&lt;P&gt;With the "informational" part added back into the search, my dashboard numbers change to &lt;/P&gt;

&lt;P&gt;"0" critical&lt;BR /&gt;
"89000" high&lt;BR /&gt;
"6200" medium&lt;BR /&gt;
"500" low &lt;BR /&gt;
"110000" informational&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 08:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491040#M194186</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2019-11-19T08:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Returned Results of "0" when event count &gt; 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491041#M194187</link>
      <description>&lt;P&gt;Hi @willadams,&lt;BR /&gt;
do you have the same results if you use a past time frame (e.g. yesterday or last hour) wiithou latest=now?&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 08:18:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491041#M194187</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-11-19T08:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Returned Results of "0" when event count &gt; 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491042#M194188</link>
      <description>&lt;P&gt;The logs have only been ingested since this morning so not a full 24 hours yet. The log technically started at aroind 3am my time and from when I wrote this question it has been 13 hours&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 08:26:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491042#M194188</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2019-11-19T08:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Returned Results of "0" when event count &gt; 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491043#M194189</link>
      <description>&lt;P&gt;I will however try and shorten the time frame to see what occurs.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 08:27:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491043#M194189</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2019-11-19T08:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Returned Results of "0" when event count &gt; 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491044#M194190</link>
      <description>&lt;P&gt;Hi @willadams,&lt;BR /&gt;
to reduce the time frame isn't important because you haven't relevant subsearches (only one inputlookup), but it could be relevant the last indexed events, for this reason try &lt;CODE&gt;earliest=-3h@h latest=-2h@h&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 08:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491044#M194190</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-11-19T08:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Returned Results of "0" when event count &gt; 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491045#M194191</link>
      <description>&lt;P&gt;The time difference reduced numbers but was incorrect based on the calculations.  As part of my dashboard (which ultimately has 10 panels) I opted to go a different route and have increased the performance of the search better.  The dashboard now loads within 10 to 15 seconds vs the almost 60 seconds the "optimised" search ran.  &lt;/P&gt;

&lt;P&gt;I found that running the search manually in native SPL was significantly faster than the search I had configured above.  Instead I created 5 seperate base search (one for each severity type) and then removed the "|search severity="..." from each panel.  &lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 04:00:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Returned-Results-of-quot-0-quot-when-event-count-gt-0/m-p/491045#M194191</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2019-11-20T04:00:56Z</dc:date>
    </item>
  </channel>
</rss>

