<?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: Is there a way to dynamically set latest in tstats? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599953#M208838</link>
    <description>&lt;P&gt;It's odd. When I run it like that I basically get double the counts, than if I just hard code the values.&lt;/P&gt;</description>
    <pubDate>Tue, 31 May 2022 16:54:54 GMT</pubDate>
    <dc:creator>fredclown</dc:creator>
    <dc:date>2022-05-31T16:54:54Z</dc:date>
    <item>
      <title>Is there a way to dynamically set latest in tstats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599325#M208641</link>
      <description>&lt;P&gt;I've done this in the past and it works to get data for today up to the latest 5 minute span, but I'm hoping to speed it up with tstats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" sourcetype="foo" earliest=-0d@d latest=[|makeresults | eval snap=floor(now()/300)*300 | return $snap]
| stats sum(b) as bytes ....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this but it doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats sum(stuff.b)as bytes from datamodel="mymodel.stuff" where index="foo" sourcetype="foo" earliest=-0d@d latest=[|makeresults | eval snap=floor(now()/300)*300 | return $snap]
| ....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I could do this potentially but it doesn't seem to be much better and quite frankly is a bit more confusing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats sum(stuff.b)as bytes from datamodel="mymodel.stuff" where index="foo" sourcetype="foo" earliest=-0d@d by _time span=1min
| where _time &amp;lt; floor(now()/300)*300
| rename stuff.* as *
| stats sum(bytes) as bytes ....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is anyway to do it in the tstats&amp;nbsp; command that would be great ... thoughts?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 18:24:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599325#M208641</guid>
      <dc:creator>fredclown</dc:creator>
      <dc:date>2022-05-25T18:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to dynamically set latest in tstats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599331#M208642</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats sum(stuff.b)as bytes from datamodel="mymodel.stuff" where index="foo" AND sourcetype="foo" AND earliest=-0d@d AND [|makeresults | eval latest=floor(now()/300)*300 | table latest] 
| ....&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 May 2022 18:14:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599331#M208642</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-05-25T18:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to dynamically set latest in tstats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599953#M208838</link>
      <description>&lt;P&gt;It's odd. When I run it like that I basically get double the counts, than if I just hard code the values.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 16:54:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599953#M208838</guid>
      <dc:creator>fredclown</dc:creator>
      <dc:date>2022-05-31T16:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to dynamically set latest in tstats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599957#M208841</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/146503"&gt;@fredclown&lt;/a&gt;&amp;nbsp;- Please check the &lt;STRONG&gt;job inspector&lt;/STRONG&gt; to see are you getting the proper latest value as you expect or not.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 17:06:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-dynamically-set-latest-in-tstats/m-p/599957#M208841</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-05-31T17:06:26Z</dc:date>
    </item>
  </channel>
</rss>

