<?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 Timechart trend over the same interval as the search range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-trend-over-the-same-interval-as-the-search-range/m-p/436260#M124340</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I have a scenario where we have used "| stats count" and gotten the total number for the range that we picked. This has been working fine, but now, we'd like to use &lt;CODE&gt;timechart&lt;/CODE&gt; to get trends.&lt;/P&gt;

&lt;P&gt;However, when using &lt;CODE&gt;timechart&lt;/CODE&gt;, the number becomes the latest "bucket" instead of the total number.&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
Searching with a time range of 60 minutes would give me the value for the last minute. &lt;/P&gt;

&lt;P&gt;Been fiddling around with some suggestions but haven't found a reliable solution. This last one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart [search index=_internal | head 1 | addinfo | eval timerange= info_max_time-info_min_time | eval span=if(round(timerange/3600) == infinity, 1, round(timerange/3600))."h"  | return span] count | appendpipe [stats count | where count=0]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It generates errors like "Error in timechart command. The value for option span (infinityh) is invalid."&lt;/P&gt;

&lt;P&gt;Any ideas of what I'm doing wrong?&lt;/P&gt;

&lt;P&gt;/Patrik&lt;/P&gt;</description>
    <pubDate>Thu, 30 Aug 2018 14:30:08 GMT</pubDate>
    <dc:creator>epacke</dc:creator>
    <dc:date>2018-08-30T14:30:08Z</dc:date>
    <item>
      <title>Timechart trend over the same interval as the search range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-trend-over-the-same-interval-as-the-search-range/m-p/436260#M124340</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I have a scenario where we have used "| stats count" and gotten the total number for the range that we picked. This has been working fine, but now, we'd like to use &lt;CODE&gt;timechart&lt;/CODE&gt; to get trends.&lt;/P&gt;

&lt;P&gt;However, when using &lt;CODE&gt;timechart&lt;/CODE&gt;, the number becomes the latest "bucket" instead of the total number.&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
Searching with a time range of 60 minutes would give me the value for the last minute. &lt;/P&gt;

&lt;P&gt;Been fiddling around with some suggestions but haven't found a reliable solution. This last one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart [search index=_internal | head 1 | addinfo | eval timerange= info_max_time-info_min_time | eval span=if(round(timerange/3600) == infinity, 1, round(timerange/3600))."h"  | return span] count | appendpipe [stats count | where count=0]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It generates errors like "Error in timechart command. The value for option span (infinityh) is invalid."&lt;/P&gt;

&lt;P&gt;Any ideas of what I'm doing wrong?&lt;/P&gt;

&lt;P&gt;/Patrik&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 14:30:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-trend-over-the-same-interval-as-the-search-range/m-p/436260#M124340</guid>
      <dc:creator>epacke</dc:creator>
      <dc:date>2018-08-30T14:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart trend over the same interval as the search range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-trend-over-the-same-interval-as-the-search-range/m-p/436261#M124341</link>
      <description>&lt;P&gt;Timechart is going to give you a new row for each bucket. Why use timechart if you don't want seperate buckets? Why use head 1 to return the latest bucket? If you were sold on using timechart then you would have to force it to use a single bucket by adding &lt;CODE&gt;span=60m&lt;/CODE&gt; which would give you identical results of using &lt;CODE&gt;stats&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;These 2 queries will give identical results &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| bin _time span=60m
| stats count by _time 



| timechart span=60m count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Aug 2018 16:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-trend-over-the-same-interval-as-the-search-range/m-p/436261#M124341</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-08-30T16:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart trend over the same interval as the search range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-trend-over-the-same-interval-as-the-search-range/m-p/436262#M124342</link>
      <description>&lt;P&gt;Timechart is used because I want the trend. Span=60m works but since I have a time picker this would not work for longer search ranges.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 05:41:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-trend-over-the-same-interval-as-the-search-range/m-p/436262#M124342</guid>
      <dc:creator>epacke</dc:creator>
      <dc:date>2018-08-31T05:41:52Z</dc:date>
    </item>
  </channel>
</rss>

