<?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: Different results using stats vs timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479467#M134381</link>
    <description>&lt;P&gt;I'm still getting the same results with the new &lt;CODE&gt;timechart&lt;/CODE&gt; command. FYI, my problem wasn't with &lt;CODE&gt;timechart&lt;/CODE&gt; showing fewer number of fields, but the &lt;CODE&gt;count&lt;/CODE&gt; value was fewer than what I'm getting from &lt;CODE&gt;stats count&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2020 02:13:20 GMT</pubDate>
    <dc:creator>wu_weidong</dc:creator>
    <dc:date>2020-01-07T02:13:20Z</dc:date>
    <item>
      <title>Different results using stats vs timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479465#M134379</link>
      <description>&lt;P&gt;I'm building a dashboard that shows a stacked column chart of different items sold in the last 6 months (using &lt;CODE&gt;timechart&lt;/CODE&gt;). For example, in Nov, there would be 2 Item A, 3 Item B, etc in the column for Nov. Then when I click on the block for Item A, I would get a table that shows the details of the 2 Item A in Nov only (using &lt;CODE&gt;stats&lt;/CODE&gt;).&lt;/P&gt;

&lt;P&gt;Part of my simple XML is as follows.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;chart&amp;gt;
   &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;... | timechart count by item span=1mon &amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;-6mon@mon&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
   &amp;lt;/search&amp;gt;
   &amp;lt;drilldown&amp;gt;
      &amp;lt;set token="trend_item_earliest"&amp;gt;$earliest$&amp;lt;/set&amp;gt;
      &amp;lt;set token="trend_item_latest"&amp;gt;$latest$&amp;lt;/set&amp;gt;
   &amp;lt;/drilldown&amp;gt;
&amp;lt;chart&amp;gt;
...
&amp;lt;table&amp;gt;
   &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;... | stats count by item &amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;$trend_item_earliest$&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;$trend_item_latest$&amp;lt;/latest&amp;gt;
   &amp;lt;/search&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To troubleshoot this, I've reduced the queries to almost exactly the same for the 2 scenarios, except for the &lt;CODE&gt;...|timechart count by item&lt;/CODE&gt; and &lt;CODE&gt;...|stats count by item&lt;/CODE&gt; at the end. Running these 2 queries in separate searches (I simply clicked on the Magnifying glass icon on each panel to open the search separately), where the time range for &lt;CODE&gt;timechart&lt;/CODE&gt; query is "Last 6 months", and the time range for &lt;CODE&gt;stats&lt;/CODE&gt; query is "during Nov 2019", still gave me different results.&lt;/P&gt;

&lt;P&gt;However, from the table I got from the &lt;CODE&gt;timechart&lt;/CODE&gt; query, if I click on one of the cells with discrepancy, e.g. the cell for Nov and Item A, and clicked "View Events", the corresponding search gave the correct number of events.&lt;/P&gt;

&lt;P&gt;Why am I getting different results?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 10:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479465#M134379</guid>
      <dc:creator>wu_weidong</dc:creator>
      <dc:date>2020-01-06T10:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Different results using stats vs timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479466#M134380</link>
      <description>&lt;P&gt;&lt;CODE&gt;timechart&lt;/CODE&gt; has a limited display by default.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;timechart limit=0 useother=f usenull=f count by item&lt;/CODE&gt;&lt;BR /&gt;
please try this.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 12:44:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479466#M134380</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-06T12:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Different results using stats vs timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479467#M134381</link>
      <description>&lt;P&gt;I'm still getting the same results with the new &lt;CODE&gt;timechart&lt;/CODE&gt; command. FYI, my problem wasn't with &lt;CODE&gt;timechart&lt;/CODE&gt; showing fewer number of fields, but the &lt;CODE&gt;count&lt;/CODE&gt; value was fewer than what I'm getting from &lt;CODE&gt;stats count&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 02:13:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479467#M134381</guid>
      <dc:creator>wu_weidong</dc:creator>
      <dc:date>2020-01-07T02:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Different results using stats vs timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479468#M134382</link>
      <description>&lt;P&gt;I did some more testing, and I noticed that the number of events returned differs when my time modifiers change. It doesn't seem to be a problem with using either &lt;CODE&gt;timechart&lt;/CODE&gt; or &lt;CODE&gt;stats&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;For example, using the exact same query, but with the addition of &lt;CODE&gt;earliest=-6mon@mon latest=X@mon&lt;/CODE&gt;, only the results for the last month is accurate, while fewer results are returned for the preceding months.&lt;/P&gt;

&lt;P&gt;The table below shows the different &lt;CODE&gt;latest&lt;/CODE&gt; modifier used and the corresponding results obtained.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;latest=   -2mon@mon    -1mon@mon     @mon         Actual no. of events
          (Jul-Oct)    (Jul-Nov)    (Jul-Dec)
Oct          37            14&amp;amp;        14&amp;amp;                 37
Nov          -             50         33^                 50
Dec          -             -          51                  51
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;amp; Missing events occurred on 30 Oct (23 events)&lt;BR /&gt;
^ Missing events occurred on 7 Nov (1), 12 Nov (1) and 17 Nov (15)&lt;/P&gt;

&lt;P&gt;How is the time modifiers affecting my results, and how can I generate a timechart that is accuate?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 03:26:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-results-using-stats-vs-timechart/m-p/479468#M134382</guid>
      <dc:creator>wu_weidong</dc:creator>
      <dc:date>2020-01-07T03:26:36Z</dc:date>
    </item>
  </channel>
</rss>

