<?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: tstats  and using timechart not displaying any results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202520#M58785</link>
    <description>&lt;P&gt;Awesome ..!! worked as expected. &lt;/P&gt;

&lt;P&gt;Thanks again SomeSoni2. &lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2016 00:13:35 GMT</pubDate>
    <dc:creator>nmohammed</dc:creator>
    <dc:date>2016-03-11T00:13:35Z</dc:date>
    <item>
      <title>tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202513#M58778</link>
      <description>&lt;P&gt;I am trying to use the tstats along with timechart for generating reports for last 3 months. We have accelerated data models.&lt;/P&gt;

&lt;P&gt;my original query without the tstats or using data models (takes forever to finish) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc  sourcetype=xyz  transaction=*  client=* | search ( date_hour &amp;lt;= 18 AND date_hour &amp;gt; 5 ) | timechart span=1d eval(round(avg(exec_time),1)) by transaction useother=f 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am writing the same query using tstats (shows matching event, but does not display any results) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats avg(exec_time) as avg_time_ms FROM datamodel=ABC groupby _time, client, transaction |timechart span=1d eval(round(avg(avg_time_ms),1)) by transaction
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can someone please guide me re-writing the query utilizing data models and tstats? &lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 00:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202513#M58778</guid>
      <dc:creator>nmohammed</dc:creator>
      <dc:date>2016-02-12T00:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202514#M58779</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats  avg(exec_time) as exec_time FROM datamodel=ABC by _time, client, trasaction span=1d   |timechart span=1d eval(round(avg(avg_time_ms),1)) by transaction
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;&lt;BR /&gt;
Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats avg(ABC.exec_time) as exec_time FROM datamodel=ABC where sourcetype=abc groupby ABC.transaction, _time span=1h | eval date_hour=tonumber(strftime(_time,"%H")) | where date_hour &amp;lt;= 18 AND date_hour &amp;gt; 5 | timechart span=1d eval(round(avg(exec_time),1)) by ABC.transaction
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Feb 2016 18:33:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202514#M58779</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-12T18:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202515#M58780</link>
      <description>&lt;P&gt;Thanks Somesoni2, &lt;/P&gt;

&lt;P&gt;I actually tried this exact query you mentioned in answers last evening, but it was showing events matched... but again did not display results.. &lt;/P&gt;

&lt;P&gt;Then I tried this one , which worked for me. &lt;/P&gt;

&lt;P&gt;| tstats count FROM datamodel=ABC where sourcetype=abc groupby ABC.transaction, ABC.client, ABC.exec_time, _time span=1d | timechart avg(ABC.exec_time) by ABC.transaction&lt;/P&gt;

&lt;P&gt;But another Challenge here was, round with eval was not working and also I was not able to pull events for specific time frame ---&amp;gt; search ( date_hour &amp;lt;= 18 AND date_hour &amp;gt; 5 ) &lt;/P&gt;

&lt;P&gt;The report required is for last 3 months and business hours. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:48:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202515#M58780</guid>
      <dc:creator>nmohammed</dc:creator>
      <dc:date>2020-09-29T08:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202516#M58781</link>
      <description>&lt;P&gt;Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 19:57:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202516#M58781</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-12T19:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202517#M58782</link>
      <description>&lt;P&gt;Thank you Somesoni2. &lt;/P&gt;

&lt;P&gt;Works Just fine..!!! &lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 21:49:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202517#M58782</guid>
      <dc:creator>nmohammed</dc:creator>
      <dc:date>2016-02-12T21:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202518#M58783</link>
      <description>&lt;P&gt;SomeSoni2,&lt;/P&gt;

&lt;P&gt;I tried this filter with other query using tstats.. the filter just doesn't work when I am trying to get results for entire day ..&lt;/P&gt;

&lt;P&gt;| tstats count(ABC.SlowCalls) as SlowCalls count(ABC.Calls) as Calls count(ABC.Errors) as Errors count as Total FROM datamodel=ABC where (sourcetype=info OR sourcetype=error) ABC.clientid=1122337 ABC.transaction_name=* groupby _time span=1h | eval qual = round(((Total-Errors)/Total)*100, 3) | eval Perf = round((1-(SlowCalls/Calls))*100, 3) | eval date_hour=tonumber(strftime(_time,"%H")) | eval date_wday=lower(strftime(_time,"%A")) | where NOT (_time=22) OR ((date_wday="wednesday" OR date_wday="friday") AND date_hour&amp;lt;2) OR ((date_wday="saturday") AND date_hour&amp;gt;=16) OR ((date_wday="sunday") AND date_hour&amp;lt;4))) &lt;/P&gt;

&lt;P&gt;SlowCalls, Calls, Errors are a calculated fields of the datamodel "ABC"  .&lt;/P&gt;

&lt;P&gt;It works perfectly if I use span=1h at with tstats , but If I change to span = 1d from span=1h , it doesn't filter the events for maintenance windows.  This is a report for one client, but I will do it for multiple clients and would essentially run daily with data in a day and not per hour.  Is there any other way to specify span or override it ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:02:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202518#M58783</guid>
      <dc:creator>nmohammed</dc:creator>
      <dc:date>2020-09-29T09:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202519#M58784</link>
      <description>&lt;P&gt;Your filter is based on date_hour and date_wday field. When you choose the span=1d, all date_hour values will become 0 as _time will be bucketed as &lt;CODE&gt;mm/dd/yyyy 00:00:00&lt;/CODE&gt;, thus your filter fails. So you need to use the span=1h, filter the events  and then again do the aggregation with span=1d.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(ABC.SlowCalls) as SlowCalls count(ABC.Calls) as Calls count(ABC.Errors) as Errors count as Total FROM datamodel=ABC where (sourcetype=info OR sourcetype=error) ABC.clientid=1122337 ABC.transaction_name=* groupby _time span=1h 
| eval date_hour=tonumber(strftime(_time,"%H")) | eval date_wday=lower(strftime(_time,"%A")) | where NOT (_time=22) OR ((date_wday="wednesday" OR date_wday="friday") AND date_hour&amp;lt;2) OR ((date_wday="saturday") AND date_hour&amp;gt;=16) OR ((date_wday="sunday") AND date_hour&amp;lt;4)))
| bucket span=1d _time | stats sum(SlowCalls) as SlowCalls sum(Calls) as Calls sum(Errors) as Erros by _time
| eval qual = round(((Total-Errors)/Total)*100, 3) | eval Perf = round((1-(SlowCalls/Calls))*100, 3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:02:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202519#M58784</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T09:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: tstats  and using timechart not displaying any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202520#M58785</link>
      <description>&lt;P&gt;Awesome ..!! worked as expected. &lt;/P&gt;

&lt;P&gt;Thanks again SomeSoni2. &lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 00:13:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-and-using-timechart-not-displaying-any-results/m-p/202520#M58785</guid>
      <dc:creator>nmohammed</dc:creator>
      <dc:date>2016-03-11T00:13:35Z</dc:date>
    </item>
  </channel>
</rss>

