<?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 display weekly data starting on a Monday using timecharts? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450867#M127675</link>
    <description>&lt;P&gt;It would be nice if the &lt;CODE&gt;span=1w&lt;/CODE&gt; of &lt;CODE&gt;timechart&lt;/CODE&gt; supported week-start modifiers but it does not (please do open an enhancement request).  So the only other option is to do as @somesoni2 says, and rewrite &lt;CODE&gt;_time&lt;/CODE&gt; so that the unchangeable "assume week starts on Monday" thinks that "Tuesday" (or whatever your preference is) is actually "Monday" by adding &lt;CODE&gt;| eval _time=relative_time(_time, "@wYourNumberHere")&lt;/CODE&gt; before your &lt;CODE&gt;timechart&lt;/CODE&gt; command.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 14:23:04 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2018-07-19T14:23:04Z</dc:date>
    <item>
      <title>How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450863#M127671</link>
      <description>&lt;P&gt;I'm plotting some data on a timechart, with a span of a couple of months, and using weeks as the data points. How can I make the chart so it takes a week from Monday-Sunday instead of Thursday-Wednesday? &lt;/P&gt;

&lt;P&gt;Thanks, &lt;BR /&gt;
Sam&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 15:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450863#M127671</guid>
      <dc:creator>samwatson45</dc:creator>
      <dc:date>2018-07-18T15:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450864#M127672</link>
      <description>&lt;P&gt;Try adding this before your timechart command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time=relative_time(_time,"@w1") | timechart span=1w ....
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 15:46:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450864#M127672</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-07-18T15:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450865#M127673</link>
      <description>&lt;P&gt;Hmm this still starts it on a Thursday. If i change the number to, say, "@w4" or "@w5" it just skips to the following Thursday.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 10:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450865#M127673</guid>
      <dc:creator>samwatson45</dc:creator>
      <dc:date>2018-07-19T10:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450866#M127674</link>
      <description>&lt;P&gt;see here:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/562033/why-is-time-chart-with-span-of-1w-always-thursday.html"&gt;https://answers.splunk.com/answers/562033/why-is-time-chart-with-span-of-1w-always-thursday.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 12:51:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450866#M127674</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-07-19T12:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450867#M127675</link>
      <description>&lt;P&gt;It would be nice if the &lt;CODE&gt;span=1w&lt;/CODE&gt; of &lt;CODE&gt;timechart&lt;/CODE&gt; supported week-start modifiers but it does not (please do open an enhancement request).  So the only other option is to do as @somesoni2 says, and rewrite &lt;CODE&gt;_time&lt;/CODE&gt; so that the unchangeable "assume week starts on Monday" thinks that "Tuesday" (or whatever your preference is) is actually "Monday" by adding &lt;CODE&gt;| eval _time=relative_time(_time, "@wYourNumberHere")&lt;/CODE&gt; before your &lt;CODE&gt;timechart&lt;/CODE&gt; command.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 14:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450867#M127675</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-19T14:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450868#M127676</link>
      <description>&lt;P&gt;it worked fine to me when i removed the "span=1w", leaving just 'eval _time=relative_time ....'&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:57:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450868#M127676</guid>
      <dc:creator>davidblj</dc:creator>
      <dc:date>2020-09-29T21:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450869#M127677</link>
      <description>&lt;P&gt;How about this?(it calculates sunday but it may help)&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;calculate the week number (0- Sunday, 6-Saturday)&lt;/LI&gt;
&lt;LI&gt;use &lt;CODE&gt;relative_time()&lt;/CODE&gt; function to do  &lt;CODE&gt;date - weeknumber&lt;/CODE&gt;. it calculates its sunday. &lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;format them to what you like with &lt;CODE&gt;strftime()&lt;/CODE&gt; function!&lt;/P&gt;

&lt;P&gt;source="randomsource.csv" &lt;BR /&gt;
| eval cr_p_date=strptime(cr_date,"%Y/%m/%d %H:%M") &lt;BR /&gt;
| eval created_week_num=strftime(cr_p_date,"%w") &lt;BR /&gt;
| eval created_week_start_p=relative_time(cr_p_date, "-".created_week_num."d@d") &lt;BR /&gt;
| eval created_week_start=strftime(created_week_start_p, "%m/%d week") &lt;BR /&gt;
| stats count by created_week_start&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:35:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450869#M127677</guid>
      <dc:creator>keiyoshiyama</dc:creator>
      <dc:date>2020-09-30T00:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to display weekly data starting on a Monday using timecharts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450870#M127678</link>
      <description>&lt;P&gt;How about this... ( it calculates sunday but it may help.)&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;convert your time field into epochtime (so that splunk can know that its date)&lt;/LI&gt;
&lt;LI&gt;week number (0, sunday - 6, saturday) can be exploited by &lt;CODE&gt;strftime([epoch time], "%w")&lt;/CODE&gt; &lt;/LI&gt;
&lt;LI&gt;function &lt;CODE&gt;relative_time(p_date, "-2d@d")&lt;/CODE&gt; gives minus 2day as result. So if you minus &lt;CODE&gt;week number&lt;/CODE&gt;from original date, you can get the date which week is same but weekday is 0(sunday.)&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;hope this helps!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="some_source.csv"  
| eval p_date=strptime(date,"%Y/%m/%d %H:%M") 
| eval week_num=strftime(p_date,"%w") 
| eval week_start_p=relative_time(p_date, "-".created_week_num."d@d") 
| eval week_start=strftime(week_start_p, "%m/%d week") 
| stats count by created_week_start
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 May 2019 06:06:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-weekly-data-starting-on-a-Monday-using-timecharts/m-p/450870#M127678</guid>
      <dc:creator>keiyoshiyama</dc:creator>
      <dc:date>2019-05-17T06:06:51Z</dc:date>
    </item>
  </channel>
</rss>

