<?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: My search doesn't count correctly in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618780#M215058</link>
    <description>&lt;P&gt;It doesn't seem like your events are multivalued? In which case this should give you the same results:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=redhatinsights earliest=-2mon@mon
| timechart span=1mon count AS event_ct&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2022 18:31:46 GMT</pubDate>
    <dc:creator>johnhuang</dc:creator>
    <dc:date>2022-10-28T18:31:46Z</dc:date>
    <item>
      <title>How would I fix my search not counting correctly?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618638#M215020</link>
      <description>&lt;P&gt;Hello y'all!&lt;BR /&gt;&lt;BR /&gt;I'm trying to use the Single Value object, and build a search which count the number of the records and shows up.. but, for some reason it's not bring the right number..&lt;BR /&gt;&lt;BR /&gt;Here is my search:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=redhatinsights 
  | spath 
  | spath path=events{} output=events
  | stats by _time, events, application, event_type, account_id, context.display_name
  | mvexpand events 
  | eval _raw=events
  | kv
  | table _time
  | where relative_time(now(), "-30d") &amp;lt;= _time
  | timechart span=30d count(_time) as count
  | appendpipe [| stats count | where count=0 | addinfo | eval time=info_min_time." ".info_max_time | makemv time | mvexpand time | table time count | rename time as _time ]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for some reason is not bring all the records, and this time range doesn't make any affect to the result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fpedrosa_0-1666905520723.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22181iE01CBFC34E0CE1CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fpedrosa_0-1666905520723.png" alt="fpedrosa_0-1666905520723.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;What's is the right way to use this object and bring the total count of the records in the last 30 days?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 18:17:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618638#M215020</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-10-28T18:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: My search doesn't count correctly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618652#M215024</link>
      <description>&lt;P&gt;Make sure you correctly account for the values that were deduped by stats and the expansion of events into multiple records.&lt;BR /&gt;&lt;BR /&gt;This is a more efficient way to replicate your search.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=redhatinsights earliest=-30d@d
| spath 
| spath path=events{} output=events
| eval event_ct=MVCOUNT(event)
| timechart span=30d sum(event_ct) AS event_ct&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 21:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618652#M215024</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-27T21:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: My search doesn't count correctly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618772#M215054</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp; thanks for your reply. Unfortunately not worked here.. using your code like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;earliest=-30d@d
| spath 
| spath path=events{} output=events
| eval event_ct=MVCOUNT(event)
| timechart span=30d sum(event_ct) AS event_ct&lt;/LI-CODE&gt;&lt;P&gt;Brings 0 (zero) even with records there.. I tried to change like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; earliest=-30d
  | spath 
  | spath path=events{} output=events
  | stats by _time, events
  | mvexpand events 
  | eval _raw=events
  | kv
  | table _time
  | timechart span=30d aligntime=latest count(_time) as event_cnt&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;show some numbers, but not the right ones..&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 17:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618772#M215054</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-10-28T17:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: My search doesn't count correctly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618773#M215055</link>
      <description>&lt;P&gt;Sorry there was a typo. Change event to events.&lt;/P&gt;&lt;P&gt;| eval event_ct=MVCOUNT(event&lt;STRONG&gt;s&lt;/STRONG&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 17:52:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618773#M215055</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-28T17:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: My search doesn't count correctly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618777#M215057</link>
      <description>&lt;P&gt;Thanks again &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp;&amp;nbsp; appears it's going somewhere.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Running your search I'm getting this on "Search":&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fpedrosa_0-1666981884394.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22218i01414011609EFD5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fpedrosa_0-1666981884394.png" alt="fpedrosa_0-1666981884394.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering if we need to have only "one" result with the all number... or I misunderstood something here?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 18:31:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618777#M215057</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-10-28T18:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: My search doesn't count correctly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618780#M215058</link>
      <description>&lt;P&gt;It doesn't seem like your events are multivalued? In which case this should give you the same results:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=redhatinsights earliest=-2mon@mon
| timechart span=1mon count AS event_ct&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 18:31:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618780#M215058</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-28T18:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: My search doesn't count correctly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618784#M215059</link>
      <description>&lt;P&gt;In my case some record may have multivalues events, or only one event... using&amp;nbsp; your last search, I'm getting several returns, not just one return with the count, and the numbers are pretty different too..&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fpedrosa_0-1666982696270.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22221i8C03F3E585F8FD6A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fpedrosa_0-1666982696270.png" alt="fpedrosa_0-1666982696270.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 18:45:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/618784#M215059</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-10-28T18:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: My search doesn't count correctly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/619162#M215195</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp; mvcount&amp;nbsp; if there isn't any record, this search returns "no result"&amp;nbsp; for the Single Value, so, it's showing like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fpedrosa_0-1667320574891.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22267iDEFA8A01FC2F112D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fpedrosa_0-1667320574891.png" alt="fpedrosa_0-1667320574891.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you know, if is possible to bring just 0&amp;nbsp; when there's no record?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 16:36:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-fix-my-search-not-counting-correctly/m-p/619162#M215195</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-11-01T16:36:34Z</dc:date>
    </item>
  </channel>
</rss>

