<?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: Bin command versus placing _time span in tstats in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745411#M10412</link>
    <description>&lt;P&gt;I personally like to put _time span=whatever like you have in your first example everywhere it will work (like with "timechart") since it works and it makes it clear what you are spanning.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the longest time I was not using timechart and span correctly until I learned you should put the span literally right next to the _time to make sure it is getting applied appropriately, so now I just do that everywhere&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But to answer your real question...what is the technical difference...IDK&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 02 May 2025 19:17:01 GMT</pubDate>
    <dc:creator>marycordova</dc:creator>
    <dc:date>2025-05-02T19:17:01Z</dc:date>
    <item>
      <title>Bin command versus placing _time span in tstats</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745383#M10411</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I wish to know the functional difference (if any) between the following:&lt;/P&gt;&lt;PRE&gt;| tstats count FROM datamodel=Endpoint.Processes where Processes.user=SYSTEM by &lt;STRONG&gt;_time span=1h&lt;/STRONG&gt; Processes.dest ...&lt;/PRE&gt;&lt;P&gt;And&lt;/P&gt;&lt;PRE&gt;| tstats count FROM datamodel=Endpoint.Processes where Processes.user=SYSTEM by Processes.dest ...&lt;BR /&gt;&lt;STRONG&gt;| bin _time span=1h&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;I understand the function and that "| bin" would always be used for a non tstats search, but within tstats is there any reason to place the "span" within the "by", or is it just cleaner/slightly faster?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 16:06:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745383#M10411</guid>
      <dc:creator>Corky_</dc:creator>
      <dc:date>2025-05-02T16:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bin command versus placing _time span in tstats</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745411#M10412</link>
      <description>&lt;P&gt;I personally like to put _time span=whatever like you have in your first example everywhere it will work (like with "timechart") since it works and it makes it clear what you are spanning.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the longest time I was not using timechart and span correctly until I learned you should put the span literally right next to the _time to make sure it is getting applied appropriately, so now I just do that everywhere&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But to answer your real question...what is the technical difference...IDK&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 19:17:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745411#M10412</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2025-05-02T19:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bin command versus placing _time span in tstats</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745414#M10413</link>
      <description>&lt;P&gt;The first example will produce a count of destinations, etc, for each hour of the search time window.&amp;nbsp; Something like this&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;_time&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Processes.dest&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;12:00&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;foo&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;12:00&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;bar&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;13:00&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;foo&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13:00&lt;/TD&gt;&lt;TD&gt;bar&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second example will produce counts by destination, etc.&amp;nbsp; The counts will not be broken down by time.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Processes.dest&lt;/TD&gt;&lt;TD width="50%"&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;foo&lt;/TD&gt;&lt;TD width="50%"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;bar&lt;/TD&gt;&lt;TD width="50%"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;bin&lt;/FONT&gt; command will have no effect because there is no _time field at that point.&lt;/P&gt;&lt;P&gt;Putting &lt;FONT face="courier new,courier"&gt;span&lt;/FONT&gt; in the &lt;FONT face="courier new,courier"&gt;tstats&lt;/FONT&gt; command gives you control over the bin sizes.&amp;nbsp; Without &lt;FONT face="courier new,courier"&gt;span&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;tstats&lt;/FONT&gt; will choose a span it thinks best fits the data.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 19:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745414#M10413</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2025-05-02T19:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Bin command versus placing _time span in tstats</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745418#M10414</link>
      <description>&lt;P&gt;If you do tstats by time without binning and then do bin, you'll have to stats again to summarise your data. Bin on its own doesn't aggregate data, just aligns the field into discrete points.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 20:56:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745418#M10414</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-05-02T20:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Bin command versus placing _time span in tstats</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745428#M10415</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/309782"&gt;@Corky_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding the first option of applying the span after the _time and before other fields in the "BY" of your tstats command, I personally prefer to put the span at the end rather than in the middle of the by list to keep it cleaner and not to be confused with a field. The &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Tstats#:~:text=%5B%20BY%20(%3Cfield%2Dlist%3E%20%7C%20(PREFIX(%3Cfield%3E)))%20%5Bspan%3D%3Ctimespan%3E%5D%5D" target="_self"&gt;tstats docs also suggests&lt;/A&gt; it should be at the end:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ BY (&amp;lt;field-list&amp;gt; | (PREFIX(&amp;lt;field&amp;gt;))) [span=&amp;lt;timespan&amp;gt;]]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The second query Im confused as to how you could bin by _time with tstats if you havent specified _time in the by clause initially. If you do not split by _time in the initial part of the query then the _time field wont be available to the bin command.&amp;nbsp;&lt;BR /&gt;FWIW - I find the bin command good for doing stats by multiple fields over _time, when you cannot do with timechart.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Sat, 03 May 2025 06:54:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Bin-command-versus-placing-time-span-in-tstats/m-p/745428#M10415</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-05-03T06:54:47Z</dc:date>
    </item>
  </channel>
</rss>

