<?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: use of tstats instead of stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456564#M129061</link>
    <description>&lt;P&gt;i understand your point and it seems fields are not indexed , in this case what should be my approach?&lt;/P&gt;

&lt;P&gt;Because when i run the query with normal way i get "search auto finilized after disk usage limit reached to 1000MB" as when i check the sourcetype count its too huge -- 1566206536&lt;/P&gt;

&lt;P&gt;index=xyz sourcetype=abc &lt;BR /&gt;
| fields TERM_SUBGRPG_CD ORIG_POINT_CD TERM_GRPG_CD DPC_CARRIER_LONG_NM CALLED_PARTY_NOA_CD DEST_POINT_CD DPC_TOLL_IND GENERIC_PORTED_SUBGRPG_CD OPC_CARRIER_LONG_NM OPC_CLLI_CD DPC_CLLI_CD SUM_BILL_TM_CNT SUM_NTWK_DURTN_CNT TOTAL_CALL_CNT DMS_FILE - _raw &lt;BR /&gt;
| fillnull value=0 &lt;BR /&gt;
| stats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT,sum(SUM_NTWK_DURTN_CNT) as SUM_NTWK_DURTN_CNT, sum(TOTAL_CALL_CNT) as TOTAL_CALL_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD &lt;BR /&gt;
| table OPC_CLLI_CD DPC_CARRIER_LONG_NM CALLED_PARTY_NOA_CD DEST_POINT_CD DPC_CLLI_CD TERM_SUBGRPG_CD SUM_BILL_TM_CNT SUM_NTWK_DURTN_CNT TOTAL_CALL_CNT &lt;BR /&gt;
| sort 0 - SUM_BILL_TM_CNT&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 01:50:07 GMT</pubDate>
    <dc:creator>vikashperiwal</dc:creator>
    <dc:date>2020-09-30T01:50:07Z</dc:date>
    <item>
      <title>use of tstats instead of stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456559#M129056</link>
      <description>&lt;P&gt;I am trying to iterate through 16million data and trying to use tstats instead of stats... please help me out in converting the stats query to tstats.&lt;BR /&gt;
 query&lt;/P&gt;

&lt;P&gt;index=xyz  sourcetype=SUMMARY&lt;BR /&gt;
| fields TERM_SUBGRPG_CD ORIG_POINT_CD TERM_GRPG_CD DPC_CARRIER_LONG_NM CALLED_PARTY_NOA_CD DEST_POINT_CD DPC_TOLL_IND GENERIC_PORTED_SUBGRPG_CD OPC_CARRIER_LONG_NM OPC_CLLI_CD DPC_CLLI_CD SUM_BILL_TM_CNT SUM_NTWK_DURTN_CNT TOTAL_CALL_CNT DMS_FILE - _raw &lt;BR /&gt;
| fillnull value=0 &lt;BR /&gt;
| stats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT,sum(SUM_NTWK_DURTN_CNT) as SUM_NTWK_DURTN_CNT, sum(TOTAL_CALL_CNT) as TOTAL_CALL_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD &lt;BR /&gt;
| table OPC_CLLI_CD DPC_CARRIER_LONG_NM CALLED_PARTY_NOA_CD DEST_POINT_CD DPC_CLLI_CD TERM_SUBGRPG_CD SUM_BILL_TM_CNT SUM_NTWK_DURTN_CNT TOTAL_CALL_CNT &lt;BR /&gt;
| sort 0 - SUM_BILL_TM_CNT&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:49:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456559#M129056</guid>
      <dc:creator>vikashperiwal</dc:creator>
      <dc:date>2020-09-30T01:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: use of tstats instead of stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456560#M129057</link>
      <description>&lt;P&gt;Here's how it might look:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT,sum(SUM_NTWK_DURTN_CNT) as SUM_NTWK_DURTN_CNT, sum(TOTAL_CALL_CNT) as TOTAL_CALL_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD where index=xyz sourcetype=SUMMARY
| table OPC_CLLI_CD DPC_CARRIER_LONG_NM CALLED_PARTY_NOA_CD DEST_POINT_CD DPC_CLLI_CD TERM_SUBGRPG_CD SUM_BILL_TM_CNT SUM_NTWK_DURTN_CNT TOTAL_CALL_CNT 
| sort 0 - SUM_BILL_TM_CNT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are some caveats:&lt;BR /&gt;
1. &lt;CODE&gt;tstats&lt;/CODE&gt; is a generating command so it must be first in the query.&lt;BR /&gt;
2. All fields referenced by &lt;CODE&gt;tstats&lt;/CODE&gt; must be indexed.  There is no search-time extraction of fields.&lt;BR /&gt;
3. &lt;CODE&gt;fillnull&lt;/CODE&gt; cannot be used since it can't precede &lt;CODE&gt;tstats&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 13:58:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456560#M129057</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-19T13:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: use of tstats instead of stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456561#M129058</link>
      <description>&lt;P&gt;Thanks for quick response.&lt;/P&gt;

&lt;P&gt;I tried the above approach but no luck, let me know if i am missing anything. I broke query into simple form.&lt;/P&gt;

&lt;P&gt;| tstats values(SUM_BILL_TM_CNT) where index=ndspr  | stats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD &lt;BR /&gt;
 | table  SUM_BILL_TM_CNT&lt;/P&gt;

&lt;P&gt;tstats--Here number of events --25,702,086 and output no results&lt;/P&gt;

&lt;P&gt;index=ndspr  | stats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD &lt;/P&gt;

&lt;P&gt;| table SUM_BILL_TM_CNT--- same number of events and i am getting output.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:49:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456561#M129058</guid>
      <dc:creator>vikashperiwal</dc:creator>
      <dc:date>2020-09-30T01:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: use of tstats instead of stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456562#M129059</link>
      <description>&lt;P&gt;| tstats values(SUM_BILL_TM_CNT) where index=ndspr | stats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD &lt;BR /&gt;
| table SUM_BILL_TM_CNT&lt;/P&gt;

&lt;P&gt;As written the tstats command should return one statistic, the list of values(SUM_BILL_TM_CNT) as "values(SUM_BILL_TM_CNT)"&lt;/P&gt;

&lt;P&gt;Therefore the stats command is not getting any of the fields referenced. &lt;/P&gt;

&lt;P&gt;If the recommended tstats search doesnt return results:&lt;/P&gt;

&lt;P&gt;| tstats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT,sum(SUM_NTWK_DURTN_CNT) as SUM_NTWK_DURTN_CNT, sum(TOTAL_CALL_CNT) as TOTAL_CALL_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD where index=xyz sourcetype=SUMMARY&lt;/P&gt;

&lt;P&gt;I would verify that all of the fields specified are INDEXED fields.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456562#M129059</guid>
      <dc:creator>solarboyz1</dc:creator>
      <dc:date>2020-09-30T01:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: use of tstats instead of stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456563#M129060</link>
      <description>&lt;P&gt;You broke the query, but not into simple form.  Queries should be broken at &lt;CODE&gt;|&lt;/CODE&gt; characters only.  Inserting extra commands doesn't help.&lt;BR /&gt;
If the query in my answer doesn't work then it's probably because the fields used in the &lt;CODE&gt;tstats&lt;/CODE&gt; command were not extracted at index time.  &lt;CODE&gt;tstats&lt;/CODE&gt; won't work otherwise.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 19:27:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456563#M129060</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-19T19:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: use of tstats instead of stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456564#M129061</link>
      <description>&lt;P&gt;i understand your point and it seems fields are not indexed , in this case what should be my approach?&lt;/P&gt;

&lt;P&gt;Because when i run the query with normal way i get "search auto finilized after disk usage limit reached to 1000MB" as when i check the sourcetype count its too huge -- 1566206536&lt;/P&gt;

&lt;P&gt;index=xyz sourcetype=abc &lt;BR /&gt;
| fields TERM_SUBGRPG_CD ORIG_POINT_CD TERM_GRPG_CD DPC_CARRIER_LONG_NM CALLED_PARTY_NOA_CD DEST_POINT_CD DPC_TOLL_IND GENERIC_PORTED_SUBGRPG_CD OPC_CARRIER_LONG_NM OPC_CLLI_CD DPC_CLLI_CD SUM_BILL_TM_CNT SUM_NTWK_DURTN_CNT TOTAL_CALL_CNT DMS_FILE - _raw &lt;BR /&gt;
| fillnull value=0 &lt;BR /&gt;
| stats sum(SUM_BILL_TM_CNT) as SUM_BILL_TM_CNT,sum(SUM_NTWK_DURTN_CNT) as SUM_NTWK_DURTN_CNT, sum(TOTAL_CALL_CNT) as TOTAL_CALL_CNT by DPC_CARRIER_LONG_NM,CALLED_PARTY_NOA_CD DEST_POINT_CD, DPC_CLLI_CD, OPC_CLLI_CD,TERM_SUBGRPG_CD &lt;BR /&gt;
| table OPC_CLLI_CD DPC_CARRIER_LONG_NM CALLED_PARTY_NOA_CD DEST_POINT_CD DPC_CLLI_CD TERM_SUBGRPG_CD SUM_BILL_TM_CNT SUM_NTWK_DURTN_CNT TOTAL_CALL_CNT &lt;BR /&gt;
| sort 0 - SUM_BILL_TM_CNT&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:50:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456564#M129061</guid>
      <dc:creator>vikashperiwal</dc:creator>
      <dc:date>2020-09-30T01:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: use of tstats instead of stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456565#M129062</link>
      <description>&lt;P&gt;If you want to use tstats, I recommend creating a data model:&lt;BR /&gt;
  &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/Knowledge/Aboutdatamodels"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/Knowledge/Aboutdatamodels&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;That includes at minimum, the fields specified in your search. &lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 14:00:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-of-tstats-instead-of-stats/m-p/456565#M129062</guid>
      <dc:creator>solarboyz1</dc:creator>
      <dc:date>2019-08-20T14:00:42Z</dc:date>
    </item>
  </channel>
</rss>

