<?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 with using tstats in search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628422#M218279</link>
    <description>&lt;P&gt;That is because your second query (with tstats) is equivalent to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=apl-cly-sap   sourcetype=cly:app:sap
|search processName="applicationstatus"
| stats count by plantime
| stats avg(plantime)&lt;/LI-CODE&gt;&lt;P&gt;which is semantically different from your first one.&lt;/P&gt;&lt;P&gt;Unless plantime is extracted at index time, there is no way to do avg on this field in tstats.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2023 06:34:07 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-01-26T06:34:07Z</dc:date>
    <item>
      <title>How to use tstats in search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628349#M218269</link>
      <description>&lt;P&gt;Hi all&lt;BR /&gt;when i run my original query i am getting one result and when i execute the same query using tstats i am getting different output.&lt;BR /&gt;AVG IS NOT MATCHING.&lt;BR /&gt;how to modify the query to match the count.&lt;/P&gt;
&lt;P&gt;my original query:&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=apl-cly-sap   sourcetype=cly:app:sap  |search processName="applicationstatus"  |stats avg(plantime)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;BR /&gt;1233.43223454&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;tstats query:&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;|tstats count where index=apl-cly-sap   sourcetype=cly:app:sap  TERM(processName=applicationstatus) by PREFIX(plantime=)
|rename plantime= as Time
 |stats avg(Time)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;output:&lt;BR /&gt;1345.7658755&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 19:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628349#M218269</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2023-01-26T19:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with using tstats in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628422#M218279</link>
      <description>&lt;P&gt;That is because your second query (with tstats) is equivalent to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=apl-cly-sap   sourcetype=cly:app:sap
|search processName="applicationstatus"
| stats count by plantime
| stats avg(plantime)&lt;/LI-CODE&gt;&lt;P&gt;which is semantically different from your first one.&lt;/P&gt;&lt;P&gt;Unless plantime is extracted at index time, there is no way to do avg on this field in tstats.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 06:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628422#M218279</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-01-26T06:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with using tstats in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628728#M218398</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;What you said is correct, but when i use tstats i am getting avg of plantime but not matching the count with&amp;nbsp; original query.&lt;BR /&gt;&lt;BR /&gt;As per my knowledge, when i run a tstats query if the field is not an index time field it will throw error and not show any results.&lt;BR /&gt;But here i am getting the results but avg of plantime is not matching. if i am getting results means the plantime is indextime field right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2023 20:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628728#M218398</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2023-01-28T20:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with using tstats in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628737#M218403</link>
      <description>&lt;P&gt;Your first search is semantically equivalent to this tstats (provided that all values of the field processName are extracted from key-value pair with equal sign):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats avg(plantime) where index=apl-cly-sap sourcetype=cly:app:sap  TERM(processName=applicationstatus)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you mean you get non-null result from the above that is different from your first search?&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 06:15:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-in-search/m-p/628737#M218403</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-01-29T06:15:07Z</dc:date>
    </item>
  </channel>
</rss>

