<?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 Maintaining _time with tscollect and tstats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168801#M48136</link>
    <description>&lt;P&gt;I've tried a number of ways, and I don't seem to be able to use tscollect effectively while maintaining a _time component. &lt;/P&gt;

&lt;P&gt;Here is my tscollect:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | bucket _time span=1d | stats [many different things] by transactionid, _time | fields - transactionid | tscollect keepresults=t namespace=mynamespace
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is my tstats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(onestat) as onestat sum(anotherstat) as anotherstat from mynamespace groupby _time [span=1d]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This just returned all of the results in one timeslot. I've also tried to mimic one of the examples from the docs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats prestats=t values(onestat) as onestat sum(anotherstat) as anotherstat from mynamespace by _time [span=1d] | timechart count 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The latter only confirms that the tstats only returns one result. The local disk also confirms that there's only a single time entry: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[root@splunksearch1 mynamespace]# ls -lh
total 18M
-rw------- 1 root root 18M Aug  3 21:36 1407049200-1407049200-18430497569978505115.tsidx
-rw------- 1 root root  86 Aug  3 21:36 splunk-autogen-params.dat
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone offer any recommendations for how I can get tscollect to store the event time?&lt;/P&gt;</description>
    <pubDate>Mon, 04 Aug 2014 04:47:07 GMT</pubDate>
    <dc:creator>David</dc:creator>
    <dc:date>2014-08-04T04:47:07Z</dc:date>
    <item>
      <title>Maintaining _time with tscollect and tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168801#M48136</link>
      <description>&lt;P&gt;I've tried a number of ways, and I don't seem to be able to use tscollect effectively while maintaining a _time component. &lt;/P&gt;

&lt;P&gt;Here is my tscollect:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | bucket _time span=1d | stats [many different things] by transactionid, _time | fields - transactionid | tscollect keepresults=t namespace=mynamespace
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is my tstats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(onestat) as onestat sum(anotherstat) as anotherstat from mynamespace groupby _time [span=1d]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This just returned all of the results in one timeslot. I've also tried to mimic one of the examples from the docs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats prestats=t values(onestat) as onestat sum(anotherstat) as anotherstat from mynamespace by _time [span=1d] | timechart count 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The latter only confirms that the tstats only returns one result. The local disk also confirms that there's only a single time entry: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[root@splunksearch1 mynamespace]# ls -lh
total 18M
-rw------- 1 root root 18M Aug  3 21:36 1407049200-1407049200-18430497569978505115.tsidx
-rw------- 1 root root  86 Aug  3 21:36 splunk-autogen-params.dat
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone offer any recommendations for how I can get tscollect to store the event time?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2014 04:47:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168801#M48136</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2014-08-04T04:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Maintaining _time with tscollect and tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168802#M48137</link>
      <description>&lt;P&gt;You are using &lt;CODE&gt;tscollect&lt;/CODE&gt; and &lt;CODE&gt;tstats&lt;/CODE&gt; incorrectly. They are not meant to be used as &lt;CODE&gt;collect&lt;/CODE&gt;/&lt;CODE&gt;summaryindex&lt;/CODE&gt; and &lt;CODE&gt;stats&lt;/CODE&gt;, which is what it appears you are trying to do. The summary indexing backfill scripts will not work with them either (for different reasons). &lt;/P&gt;

&lt;P&gt;You could use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fields &amp;lt;fields you are interested in&amp;gt; transactionid _time | tscollect namespace=mynamespace
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But then you will be responsible for backfill and missed data yourself. (As mentioned the summary backfill will not work with &lt;CODE&gt;tscollect&lt;/CODE&gt; as it does with &lt;CODE&gt;collect&lt;/CODE&gt;.) So really you should create a data model that contains all the fields you might be interested in working with and accelerate that data model instead. You can use then use tstats against the accelerated data model.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2014 08:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168802#M48137</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2014-08-04T08:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Maintaining _time with tscollect and tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168803#M48138</link>
      <description>&lt;P&gt;It looks like what you're saying is that tscollect cannot receive the output of a stats command. Is that correct? The challenge with this data source (and why I originally failed using data models) is that a handful of the fields are in the starting event, and a handful in the ending event. Without using a stats (or transaction, etc.), I was having to store the transactionid and two events, so the default count the data model put in was inaccurate. tscollect was an attempt to work around that limitation. What is the right way to leverage acceleration here? (Search DM of Events DM?)&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2014 13:54:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168803#M48138</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2014-08-04T13:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Maintaining _time with tscollect and tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168804#M48139</link>
      <description>&lt;P&gt;tscollect &lt;EM&gt;can&lt;/EM&gt; collect from stats. It just wasn't designed for it, and backfilling is usually a disaster especially if you have more than one indexer. &lt;/P&gt;

&lt;P&gt;If you must, your problem has nothing to do with &lt;CODE&gt;tscollect&lt;/CODE&gt;, but because you're using &lt;CODE&gt;stats&lt;/CODE&gt; and omitting &lt;CODE&gt;_time&lt;/CODE&gt; on the "by" clause, so there's no &lt;CODE&gt;_time&lt;/CODE&gt; being passed to &lt;CODE&gt;tscollect&lt;/CODE&gt; in the first place. Just because you're running a specific range a day at a time, you must still include &lt;CODE&gt;_time&lt;/CODE&gt;. (This is one of those things that the backfill scripts and addinfo scripts do for you with &lt;CODE&gt;collect&lt;/CODE&gt; that &lt;CODE&gt;tscollect&lt;/CODE&gt; does not handle.)&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2014 22:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168804#M48139</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2014-08-04T22:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Maintaining _time with tscollect and tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168805#M48140</link>
      <description>&lt;P&gt;But the way you're using it, you're sort of defeating one of the main points of &lt;CODE&gt;tscollect&lt;/CODE&gt;/&lt;CODE&gt;tstats&lt;/CODE&gt; and that is to keep data in full fidelity, and to be able to therefore run any stats over it without specifying it ahead of time. You can do this I guess. But then I'd recommend that you at least just do as little aggregation on the fields as possible so that you can still do aggregations afterwards.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2014 22:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168805#M48140</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2014-08-04T22:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Maintaining _time with tscollect and tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168806#M48141</link>
      <description>&lt;P&gt;It turns out my root cause was a lookup table I had in line had a leftover _time field not removed, which was overwriting the _time of the event. In essence, the above works perfectly, so long as you're not sabotaging yourself.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2014 18:30:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Maintaining-time-with-tscollect-and-tstats/m-p/168806#M48141</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2014-08-05T18:30:23Z</dc:date>
    </item>
  </channel>
</rss>

