<?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: timechart not using correct _time timeframe in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460958#M130032</link>
    <description>&lt;P&gt;to second @richgalloway 's comment&lt;BR /&gt;
@weidertc have you checked that individually both the timecharts give outputs (counts), i ran your query and tinkered with the time modifiers, it is highly probable that your second time modifiers , inside the append is not returning any results. In this case you do a cont=f or fillnull value=0&lt;BR /&gt;
the issue is not with the timechart but with the modifiers and the respective counts generated by the timechart using those modifiers&lt;/P&gt;</description>
    <pubDate>Sat, 24 Aug 2019 19:03:53 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2019-08-24T19:03:53Z</dc:date>
    <item>
      <title>timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460956#M130030</link>
      <description>&lt;P&gt;I have a dashboard with 2 columns of panels, each containing the same 5 panels, 5 on the left and 5 on the right.  the difference between the columns is the timeframe the user chose.  the right is the current, and the left is 2 weeks ago.  I want to use base search for both so I only need one cpu thread to power the dashboard.&lt;/P&gt;

&lt;P&gt;here is my query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=asdf this=that earliest=-60m@m latest=+1m@m
| eval timeframe=1
| append
    [ search index=asdf this=that earliest=-2w@m-60m latest=-2w@m+1m
    | eval timeframe=2 ]
| where timeframe=2
| timechart count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is the | where timeframe=2.&lt;/P&gt;

&lt;P&gt;If i put | where timeframe=1, then the _time column in the timechart displays 60 minutes' worth, so 60 rows, of the timeframe from the outer search.  this is good.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                       count
8/23/2019 00:00             32
[...]                 
8/23/2019 01:00             45
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If i put | where timeframe=2, then the _time column in the timechart displays 120 minutes' worth, so 120 rows, of both timeframe 1 and 2.  The 2nd half of the timeframe is empty, but the _time still shows it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                       count
8/09/2019 00:00             16
[...]                 
8/09/2019 01:00             22
8/23/2019 00:00
[...]                 
8/23/2019 01:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to avoid having to run 5 inline searches plus a base search for the other 5.  i want 1 base search for both sides.&lt;/P&gt;

&lt;P&gt;How do i get the _time of "only" timeframe=2 in my chart?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 20:37:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460956#M130030</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-08-23T20:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460957#M130031</link>
      <description>&lt;P&gt;By default, &lt;CODE&gt;timechart&lt;/CODE&gt; fills in missing data points, which is how you end up with rows for today as well those for 2 weeks ago.  Use the &lt;CODE&gt;cont=false&lt;/CODE&gt; option to disable that.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Aug 2019 16:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460957#M130031</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-24T16:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460958#M130032</link>
      <description>&lt;P&gt;to second @richgalloway 's comment&lt;BR /&gt;
@weidertc have you checked that individually both the timecharts give outputs (counts), i ran your query and tinkered with the time modifiers, it is highly probable that your second time modifiers , inside the append is not returning any results. In this case you do a cont=f or fillnull value=0&lt;BR /&gt;
the issue is not with the timechart but with the modifiers and the respective counts generated by the timechart using those modifiers&lt;/P&gt;</description>
      <pubDate>Sat, 24 Aug 2019 19:03:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460958#M130032</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-24T19:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460959#M130033</link>
      <description>&lt;P&gt;Thanks for the insight.&lt;/P&gt;

&lt;P&gt;I checked both for values present.  In this case, there are records in both.  The where clause successfully hides the records in the other week.  The cont=f does actually work, but not without suppressing the x-axis major label (the date/year and approximate time of day), which is not really going to work that well.&lt;/P&gt;

&lt;P&gt;What do you mean by modifiers?  do you mean the where clause?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 13:59:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460959#M130033</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-08-26T13:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460960#M130034</link>
      <description>&lt;P&gt;Interesting.  So the where clause doesn't remove the records, just the data in them.  That is really unfortunate, and borderline ridiculous, since the where clause removes the whole records in every other query I write, not just the data in them.&lt;/P&gt;

&lt;P&gt;I tried cont=false, and while it does remove those records from showing, it also removes the x-axis major label, (the date/year and approximate time of day), so I can no longer tell what hour is at the beginning, middle, and end.&lt;/P&gt;

&lt;P&gt;Is there a way to keep the labels?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 14:05:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460960#M130034</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-08-26T14:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460961#M130035</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/62631"&gt;@weidertc&lt;/a&gt; &lt;BR /&gt;
Sorry, I did not explain clearly&lt;BR /&gt;
Let us look at your query-&lt;BR /&gt;
index=asdf this=that earliest=-60m@m latest=+1m@m&lt;BR /&gt;
 | eval timeframe=1&lt;BR /&gt;
 | append&lt;BR /&gt;
     [ search index=asdf this=that earliest=-2w@m-60m latest=-2w@m+1m&lt;BR /&gt;
     | eval timeframe=2 ]&lt;BR /&gt;
 | where timeframe=2&lt;BR /&gt;
 | timechart count&lt;BR /&gt;
Now, how does this query get executed?&lt;BR /&gt;
1- the sub search, that is the append gets executed first and sets timeframe=2&lt;BR /&gt;
2- Now, the main search gets executed. Here irrespective of what you set the value timeframe as, in the append sub search, &lt;EM&gt;you over write this by setting timeframe as 1&lt;/EM&gt;&lt;BR /&gt;
3- When i ran this query on the default audit index, i received exactly what i expected - no results found because timeframe is ALWAYS =1 , irrespective of what you set in the append sub search. Try this query as is , since _audit is a delivered index it should run as it is. something like this - &lt;CODE&gt;index=_audit  earliest=-60m@m latest=+1m@m&lt;BR /&gt;
 | eval timeframe=1&lt;BR /&gt;
 | append&lt;BR /&gt;
     [ search index=audit  earliest=-2w@m-60m latest=-2w@m+1m&lt;BR /&gt;
     | eval timeframe=2 ]&lt;BR /&gt;
 | where timeframe=2&lt;BR /&gt;
 | timechart count&lt;/CODE&gt;&lt;BR /&gt;
Execute this first with |where timeframe=2 and then with |where timeframe=1, see the difference? Also, let timeframe remain as 2 in the sub search but set eval timeframe=2 in the main search, you will get results...&lt;/P&gt;

&lt;P&gt;What I am not getting is how you get an output when timeframe=2 , it should not ideally return any results &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt; can you please advise? I must confess that I am not able to understand the this=that part of the query. As per me the query should not return any results and will ALWAYS return results based on the value of timeframe as set in the main query &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:55:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460961#M130035</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-30T01:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460962#M130036</link>
      <description>&lt;P&gt;I tried this search, but access is whitelisted and I only have a few indexes I can use.  This returned no results, (even after fixing what may be a typo with the underscore).&lt;/P&gt;

&lt;P&gt;the "this=that" is a replacement for my actual filters, which wouldn't make sense to anyone outside of our organization.  I simplified it considerably to exaggerate the framework of the query and isolate the part that may need to change.&lt;/P&gt;

&lt;P&gt;I would also like to know why i get any results at all if the outer query value of timeframe overwrites the inner one.  I didn't think they would since they are only set for the contents of the records which that search returns, of which none overlap due to the time difference.&lt;/P&gt;

&lt;P&gt;Maybe "append" just isn't the right command here.  I just need 2 (or more) sets of results from different weeks.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 15:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460962#M130036</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-08-26T15:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460963#M130037</link>
      <description>&lt;P&gt;Adding "fixedrange=false" accomplishes what cont=false does, but allows for the x-axis labels to remain intact. This restricts the _time to just what the where clause dictates, but keeps the date/time and approximate hour at beginning, end, and a few in between present.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=asdf this=that earliest=-60m@m latest=+1m@m
| eval timeframe=1
| append
    [ search index=asdf this=that earliest=-2w@m-60m latest=-2w@m+1m
    | eval timeframe=2 ]
| where timeframe=2
| timechart fixedrange=false count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Aug 2019 15:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460963#M130037</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-08-26T15:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460964#M130038</link>
      <description>&lt;P&gt;hi @weidertc &lt;BR /&gt;
I don't think I deserve any credit for the solution  at all, it was you who solved your issue yourself &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; so kudos for that,hence no answers (wrong answers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ???) from my side.&lt;BR /&gt;
 You should convert your comment o an answer and accept it , I will up vote it.&lt;BR /&gt;
I am sorry for any confusion caused, I tried to the best of my knowledge and ability&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 19:43:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460964#M130038</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-26T19:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not using correct _time timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460965#M130039</link>
      <description>&lt;P&gt;thanks, i converted this to an answer.  no confusion caused.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 16:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-using-correct-time-timeframe/m-p/460965#M130039</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-08-30T16:48:24Z</dc:date>
    </item>
  </channel>
</rss>

