<?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: How to start a timechart on a dashboard on Monday without earliest and latest? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205301#M59683</link>
    <description>&lt;P&gt;Try the updated answer to manage all times as well.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Sep 2015 19:14:03 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-09-08T19:14:03Z</dc:date>
    <item>
      <title>How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205293#M59675</link>
      <description>&lt;P&gt;I have a timechart on a dashboard that sums Things by Description* with a span of a week. Since my first Thing event is on a Thursday, my week seems to run Thursday to Thursday on the timechart. If a different chart on the same dashboard has its first Thing event on a Tuesday, it will start on Tuesday. &lt;/P&gt;

&lt;P&gt;I've looked at other questions that used earliest, and tried something like earliest=-3y@w1, which does snap everything to Monday. Unfortunately, it also plots a bunch of blank space to the left of all my data in the timechart.   I can work around that by using chart instead of timechart: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=* earliest=-3y@w1 | reverse | bin _time span=1w | eval time=strftime(_time, "%m-%d-%y") | chart sum(Thing) by time,Description
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which will work great for all time, but will not work if there is a time picker on the dash board, since the earliest in the search will override the time picker. &lt;/P&gt;

&lt;P&gt;Also, the chart renders with white space between columns for Description, time combos where there are no Things. I'd like to get rid of that white space, without stacking the columns. &lt;/P&gt;

&lt;P&gt;*I am only able to provide generalized examples of my data &lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 15:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205293#M59675</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-09-04T15:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205294#M59676</link>
      <description>&lt;P&gt;The reason that &lt;CODE&gt;earliest=-3y@w1&lt;/CODE&gt; plots a bunch of blank space to the left of all your data in the timechart is because of the &lt;CODE&gt;-3y&lt;/CODE&gt; part which means go back 3 years!  Change it to something more reasonable like &lt;CODE&gt;-1m@w1&lt;/CODE&gt; which goes back 1 month and maybe that is all you need.  The &lt;CODE&gt;snap-to Monday&lt;/CODE&gt; part is the &lt;CODE&gt;@w1&lt;/CODE&gt; portion.  Also, you surely don't need to use &lt;CODE&gt;reverse&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 16:00:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205294#M59676</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-04T16:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205295#M59677</link>
      <description>&lt;P&gt;This is exactly the problem -- I want to look at the history from an arbitrary start date to an arbitrary end date, or by relative time pickers like previous week, previous month, previous quarter. If I have something like -1m@w1 and my   user picks previous quarter, they'll only see one month of data. &lt;/P&gt;

&lt;P&gt;-3y is long but will ensure that I never mislead myself by overriding the time picker with something hidden under the hood in the search string. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 16:06:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205295#M59677</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-09-04T16:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205296#M59678</link>
      <description>&lt;P&gt;Why don't you skip the time-picker and have your own drop down with the values you like that maps to the first part of the &lt;CODE&gt;earliest&lt;/CODE&gt; value?  You could have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="dropdown" token="span_token"&amp;gt;
  &amp;lt;label&amp;gt;Span Picker&amp;lt;/label&amp;gt;
  &amp;lt;choice value="-1w"&amp;gt;Last Week&amp;lt;/choice&amp;gt;
  &amp;lt;choice value="-1mon"&amp;gt;Last Month&amp;lt;/choice&amp;gt;
  &amp;lt;choice value="-1q"&amp;gt;Last Quarter&amp;lt;/choice&amp;gt;
  &amp;lt;choice value="-1y"&amp;gt;Last Year&amp;lt;/choice&amp;gt;
  &amp;lt;default&amp;gt;Last Week&amp;lt;/default&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you use &lt;CODE&gt;earliest=$span_token$@w1&lt;/CODE&gt; in your search.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 16:34:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205296#M59678</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-04T16:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205297#M59679</link>
      <description>&lt;P&gt;If you want to snap your timerange from monday (@w1) but still want to respect the user selection via time range picker, try something like this (using a subsearch to generate earliest based on time range picker)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=* [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"@w1") | table earliest ] | reverse | bin _time span=1w | eval time=strftime(_time, "%m-%d-%y") | chart sum(Thing) by time,Description
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where,&lt;BR /&gt;
    gentimes - just to add one single row placeholder&lt;BR /&gt;
    addinfo - adds timerange picker values (search timerange) in epoch to the search result. Main fields added is info_min_time(earliest) and info_max_time(latest)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;&lt;BR /&gt;
To handle all times&lt;/P&gt;

&lt;P&gt;Since with all time, earliest will be 0 (epoch lowest value supported by Splunk ) i.e. Thu, 01 Jan 1970  GMT, relative time @w1 would not exist. Try this workaround for the same (to consider next monday Mon, 05 Jan 1970&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=* [| gentimes start=-1 | addinfo | eval info_min_time=if(info_min_time=0,604800,info_min_time)| eval earliest=relative_time(info_min_time,"@w1") | table earliest ] | reverse | bin _time span=1w | eval time=strftime(_time, "%m-%d-%y") | chart sum(Thing) by time,Description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:13:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205297#M59679</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T07:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205298#M59680</link>
      <description>&lt;P&gt;I should have thought of that (addinfo + relative_time); very nice.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 17:48:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205298#M59680</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-04T17:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205299#M59681</link>
      <description>&lt;P&gt;Works great, unless the selection is all time. &lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:11:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205299#M59681</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-09-08T17:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205300#M59682</link>
      <description>&lt;P&gt;This would go in the XML code for the dashboard? &lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:12:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205300#M59682</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-09-08T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205301#M59683</link>
      <description>&lt;P&gt;Try the updated answer to manage all times as well.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 19:14:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205301#M59683</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-08T19:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205302#M59684</link>
      <description>&lt;P&gt;The update does not appear to be working for all time. Previous month, previous year, etc still start weeks on Monday with the updated code. &lt;/P&gt;

&lt;P&gt;I can't get the gentimes search to work on its own in a search, so I can't check the if statements. Any suggestions there? Do I need to debug in a dashboard panel? &lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 19:28:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205302#M59684</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-09-08T19:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205303#M59685</link>
      <description>&lt;P&gt;You can run the search like this as regular search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | addinfo | eval info_min_time=if(info_min_time=0,43200,info_min_time)| eval earliest=relative_time(info_min_time,"@w1") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Sep 2015 21:25:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205303#M59685</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-08T21:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205304#M59686</link>
      <description>&lt;P&gt;I think the timezone of yours may be making the adjustment 43200 not sufficient enough to get to first monday. So I updated 43200 (5 days) with 604800 (7 days) to be sure. I tested and it works fine. Answer updated.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 21:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205304#M59686</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-08T21:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205305#M59687</link>
      <description>&lt;P&gt;Thank you so much for your help. This now works great for chart visualizations, but does not work for timecharts. In that case, you'd be better off using a small window of time and earliest like @woodcock suggested, or his custom time picker code. &lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 20:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205305#M59687</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-09-10T20:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to start a timechart on a dashboard on Monday without earliest and latest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205306#M59688</link>
      <description>&lt;P&gt;Yes, exactly.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 22:27:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-start-a-timechart-on-a-dashboard-on-Monday-without/m-p/205306#M59688</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-10T22:27:56Z</dc:date>
    </item>
  </channel>
</rss>

