<?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: help on timechart vs stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592659#M206288</link>
    <description>&lt;P&gt;I understand (you might try xyseries sometimes instead of timechar though) but I'm talking about a completly different thing.&lt;/P&gt;&lt;P&gt;Let's take a very simple search.&lt;/P&gt;&lt;PRE&gt;| makeresults count=3600 | streamstats count | eval _time=count | bin _time span=1m | stats count by _time&lt;/PRE&gt;&lt;P&gt;You should get&amp;nbsp; 60 rows of results, all of them with count=60&lt;/P&gt;&lt;P&gt;But if you add&lt;/P&gt;&lt;PRE&gt;| timechart count by _time span=1m&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;You will be counting the results of the summarized stats, not the original data. So it's obvous that you'll get 60 results of count=1.&lt;/P&gt;&lt;P&gt;That's what I'm talking about. And that's why your timechart command is doing wrong calculation. You should be doing other form of aggregation (most probably sum or avg) instead of count. With count you're only counting _rows of stats table_, not the actual original data.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2022 11:30:49 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2022-04-06T11:30:49Z</dc:date>
    <item>
      <title>Why the result of the timechart command for a specific hour is different than the result of the stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592575#M206253</link>
      <description>&lt;P&gt;hello&lt;/P&gt;
&lt;P&gt;I use 2 similar searc&lt;/P&gt;
&lt;P&gt;In the first I timechart the results&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;   | bin _time span=1h 
 | stats count as Pb by tutu _time 
    | search Pb &amp;gt; 1 
    | timechart span=1h dc(tutu) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and in the second I stats the results&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| bin _time span=1h
| stats count as Pb by tutu _time 
| search Pb &amp;gt; 1 &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;What I dont understand is that the result of the timechart command (screen 1) for a specific hour (18h for example) is different (I just have one event) than the result of the stats command (screen 2) because I have 7 events&lt;/P&gt;
&lt;P&gt;screen 1&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jip31_0-1649225179545.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18957i09B9A3324EF8CDAC/image-size/large?v=v2&amp;amp;px=999" role="button" title="jip31_0-1649225179545.png" alt="jip31_0-1649225179545.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;screen 2&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jip31_1-1649225442350.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18959iB4833BAB133DF2AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jip31_1-1649225442350.png" alt="jip31_1-1649225442350.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 15:26:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592575#M206253</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2022-04-06T15:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: help on timechart vs stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592601#M206264</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the difference is probably in the bin command: if you put the bin command before the stats in the first search you'll probably have the same results.&lt;/P&gt;&lt;P&gt;In your search you group by _time but you didin't grouped in bin so you have many different results and the condition &amp;gt;1 many times isn't true.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 08:10:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592601#M206264</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-06T08:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: help on timechart vs stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592614#M206270</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;unfortunately, its not the bin because I put it also in the first search (i just have forgotten to add it in the first search)&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 08:37:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592614#M206270</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2022-04-06T08:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: help on timechart vs stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592615#M206271</link>
      <description>&lt;P&gt;i&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I suppose that PbPerf in the secondsearch is an error!&lt;/P&gt;&lt;P&gt;Anyway adding bin command in the first search your searches are equal, and the timechart isn't relevant.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 08:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592615#M206271</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-06T08:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: help on timechart vs stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592628#M206273</link>
      <description>&lt;P&gt;You're doing two different things. In your second search (the one without the timechart), you're looking for count of some events during every hour in division among single tutu fields.&lt;/P&gt;&lt;P&gt;But if you add timechart dc(tutu) to this, you're only counting distict values of tutu field in the results of the stats which most probably is not what you want.&lt;/P&gt;&lt;P&gt;If you're piping results of stats count into a timechart, you usually want some form of sum, avg or values aggregation. You usually don't want the count aggregation again.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 09:33:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592628#M206273</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-06T09:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: help on timechart vs stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592634#M206275</link>
      <description>&lt;P&gt;No Pb is not an error because I need to use this threshold&lt;/P&gt;&lt;P&gt;I just need to display the events in 2 different way thats why I use 2 search&lt;/P&gt;&lt;P&gt;And concerning timechart I need to use it because I use a lot of subsearch in this search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| appendcols
[ search index=toto
| bin _time span=1h 
| stats count as Pb by tutu _time 
| search Pb &amp;gt; 1 
| timechart span=1h dc(tutu) ]
....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 09:37:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592634#M206275</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2022-04-06T09:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: help on timechart vs stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592640#M206279</link>
      <description>&lt;P&gt;I understand but I need to use timechart in my search because I use different appendcols in this search&lt;/P&gt;&lt;P&gt;As you know, appendcols does not correlate the values in the rows, it just adds data rows in the order returned i.e. the first row returned will be added to the first row of the current set, this means the results can get out of line. So I use timechart in order to generate the "missing" time periods.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 09:46:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592640#M206279</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2022-04-06T09:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: help on timechart vs stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592659#M206288</link>
      <description>&lt;P&gt;I understand (you might try xyseries sometimes instead of timechar though) but I'm talking about a completly different thing.&lt;/P&gt;&lt;P&gt;Let's take a very simple search.&lt;/P&gt;&lt;PRE&gt;| makeresults count=3600 | streamstats count | eval _time=count | bin _time span=1m | stats count by _time&lt;/PRE&gt;&lt;P&gt;You should get&amp;nbsp; 60 rows of results, all of them with count=60&lt;/P&gt;&lt;P&gt;But if you add&lt;/P&gt;&lt;PRE&gt;| timechart count by _time span=1m&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;You will be counting the results of the summarized stats, not the original data. So it's obvous that you'll get 60 results of count=1.&lt;/P&gt;&lt;P&gt;That's what I'm talking about. And that's why your timechart command is doing wrong calculation. You should be doing other form of aggregation (most probably sum or avg) instead of count. With count you're only counting _rows of stats table_, not the actual original data.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 11:30:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-the-result-of-the-timechart-command-for-a-specific-hour-is/m-p/592659#M206288</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-06T11:30:49Z</dc:date>
    </item>
  </channel>
</rss>

