<?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: Timechart not gives correct values after stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575842#M200666</link>
    <description>&lt;P&gt;No , what i am getting in 2nd search is the expected count .IS it possible to make the timechart display the same count,bcoz that is the requirement .I need to show the % for the same count as in Second count .&lt;/P&gt;&lt;P&gt;Is it possible to use chart or something else to bring the same count in timechart .&lt;/P&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>Mon, 22 Nov 2021 10:36:37 GMT</pubDate>
    <dc:creator>dtccsundar</dc:creator>
    <dc:date>2021-11-22T10:36:37Z</dc:date>
    <item>
      <title>Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575820#M200654</link>
      <description>&lt;P&gt;My query ,&lt;/P&gt;&lt;P&gt;index=s_New sourcetype IN (Compare,Fire)&lt;BR /&gt;| stats values(*) as * values(sourcetype) as sourcetype by sysid _time&lt;BR /&gt;| fillnull value=""&lt;BR /&gt;| eval Status=if(Fire_Agent_Version = "" AND Compare_Agent_Version = "","Not Covered","Covered")&lt;BR /&gt;&amp;nbsp;| search OS="*" Group="*" Name="***" Environment="*"&lt;BR /&gt;| timechart span=1d count by Status&lt;BR /&gt;| addtotals&lt;BR /&gt;| eval "Covered %"=round((Covered/Total)*100,2)&lt;BR /&gt;| eval "Not Covered %"=round(('Not Covered'/Total)*100,2)&lt;BR /&gt;| fields _time "Covered %" "Not Covered %"&lt;BR /&gt;&lt;BR /&gt;The above search not providing expected count as i get i get for Status count&amp;nbsp; as below ,&lt;/P&gt;&lt;P&gt;iindex=s_New sourcetype IN (Compare,Fire)&lt;BR /&gt;| stats values(*) as * values(sourcetype) as sourcetype by sysid&amp;nbsp;&lt;BR /&gt;| fillnull value=""&lt;BR /&gt;| eval Status=if(Fire_Agent_Version = "" AND Compare_Agent_Version = "","Not Covered","Covered")&lt;BR /&gt;&amp;nbsp;| search OS="*" Group="*" Name="***" Environment="*"&lt;/P&gt;&lt;P&gt;| stats count by Status&lt;BR /&gt;| eventstats sum(*) as sum_*&lt;BR /&gt;| foreach *&lt;BR /&gt;[ eval "Status %"=round((count/sum_count)*100,2)]&lt;BR /&gt;| rename count as Count&lt;BR /&gt;| fields - sum_count&lt;BR /&gt;| sort - Count&lt;/P&gt;&lt;P&gt;I think i am missing&amp;nbsp; something in timechart search .How to get he exact count for timechart as in below search using stats alone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 08:05:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575820#M200654</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2021-11-22T08:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575828#M200657</link>
      <description>&lt;P&gt;Your first search is counting sysids per days by status, the second is counting sysids by just status. In the first instance a sysid may appear on more than one day. This is why your counts are different.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 08:37:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575828#M200657</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-22T08:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575832#M200660</link>
      <description>&lt;P&gt;Yes you are right ,but is it possible to make the timechart show a particular days data alone&amp;nbsp; to match the second search in this case ?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 09:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575832#M200660</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2021-11-22T09:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575836#M200663</link>
      <description>&lt;P&gt;I am not sure what you are asking for - the timechart is already breaking it down by days and the second search has no time element in it - do you just want to add the time element into the second search?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 10:00:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575836#M200663</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-22T10:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575842#M200666</link>
      <description>&lt;P&gt;No , what i am getting in 2nd search is the expected count .IS it possible to make the timechart display the same count,bcoz that is the requirement .I need to show the % for the same count as in Second count .&lt;/P&gt;&lt;P&gt;Is it possible to use chart or something else to bring the same count in timechart .&lt;/P&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>Mon, 22 Nov 2021 10:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575842#M200666</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2021-11-22T10:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575846#M200668</link>
      <description>&lt;LI-CODE lang="markup"&gt;| chart count by sysid Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 10:37:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575846#M200668</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-22T10:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575851#M200670</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Nope , this didnt worked out .Please let me know if this can achieved other way ?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 11:00:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575851#M200670</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2021-11-22T11:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575852#M200671</link>
      <description>&lt;P&gt;Please can you give examples of what you are getting from the two searches and how you would like them to be different?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 11:16:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575852#M200671</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-22T11:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575856#M200672</link>
      <description>&lt;P&gt;Search 1: ( which needs to be modified)&lt;/P&gt;&lt;P&gt;index=s_New sourcetype IN (Compare,Fire) | stats values(*) as * values(sourcetype) as sourcetype by sysid _time | fillnull value="" | eval Status=if(Fire_Agent_Version = "" AND Compare_Agent_Version = "","Not Covered","Covered") | search OS="*" Group="*" Name="***" Environment="*" | timechart span=1d count by Status | addtotals | eval "Covered %"=round((Covered/Total)*100,2) | eval "Not Covered %"=round(('Not Covered'/Total)*100,2) | fields _time "Covered %" "Not Covered %"&lt;/P&gt;&lt;P&gt;Output i receive :&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;_time&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Covered&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Not Covered&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;2021-11-21&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;7918&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;2614&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The above search not providing expected count as i get i get for Status count as below ,&lt;/P&gt;&lt;P&gt;Search 2 : (Correct one with expected count )&lt;BR /&gt;index=s_New sourcetype IN (Compare,Fire) | stats values(*) as * values(sourcetype) as sourcetype by sysid | fillnull value="" | eval Status=if(Fire_Agent_Version = "" AND Compare_Agent_Version = "","Not Covered","Covered") | search OS="*" Group="*" Name="***" Environment="*" | stats count by Status | eventstats sum(*) as sum_* | foreach * [ eval "Status %"=round((count/sum_count)*100,2)] | rename count as Count | fields - sum_count | sort - Count&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Output i receive :&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Status&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Count&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Status %&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Covered&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;5030&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;93.97&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Not Covered&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;323&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;6.03&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I want the count as in search 2 for timechart too (as in search 1 above )&amp;nbsp; for last 30 days or so .&lt;/P&gt;&lt;P&gt;I hope this helps you .Please let me know if you need more info .&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 11:33:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575856#M200672</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2021-11-22T11:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575858#M200674</link>
      <description>&lt;P&gt;Your searches are a bit confused. Try executing them one line at a time to see what they are doing to see if you can work out what might be wrong.&lt;/P&gt;&lt;P&gt;Having said that, in search 1, your initial stats in based on _time (as well as sysid). Since you haven't done any bucketing at this point, you could get multiple stats for the same day, so you could try putting&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bin _time span=1d&lt;/LI-CODE&gt;&lt;P&gt;before the initial stats to see if that gives you what you are looking for.&lt;/P&gt;&lt;P&gt;In the second search, the foreach applies to each field (column) for each row, and since it is evaluating the same thing every time, there is no need to enclose it in a foreach, just use&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval "Status %"=round((count/sum_count)*100,2)&lt;/LI-CODE&gt;&lt;P&gt;After all that, your two searches are still doing different things (unless you time period is already restricted to a single day). This is because there is no time element in search 2 (as I said earlier), so you won't get the same result from the two searches (for periods greater than a single day).&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 12:03:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575858#M200674</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-22T12:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart not gives correct values after stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575867#M200678</link>
      <description>&lt;P&gt;This made the search to work ,&lt;/P&gt;&lt;P&gt;| bin _time span=1d&lt;/P&gt;&lt;P&gt;Thank you !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 13:24:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-not-gives-correct-values-after-stats/m-p/575867#M200678</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2021-11-22T13:24:31Z</dc:date>
    </item>
  </channel>
</rss>

