<?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: time range to display count of weekly in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312595#M58583</link>
    <description>&lt;P&gt;@niketnilay .. thanks. it was working&lt;/P&gt;</description>
    <pubDate>Wed, 04 Apr 2018 04:58:45 GMT</pubDate>
    <dc:creator>DataOrg</dc:creator>
    <dc:date>2018-04-04T04:58:45Z</dc:date>
    <item>
      <title>time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312588#M58576</link>
      <description>&lt;P&gt;i have 4 months data. where i want to display the order count in weekly range.for example&lt;/P&gt;

&lt;P&gt;date                                          count&lt;BR /&gt;
2018/03/01 - 2018/03/07        450&lt;BR /&gt;
2018/03/08 - 2018/03/14         650&lt;BR /&gt;
2018/04/22 - 2018/04/28         745&lt;/P&gt;

&lt;P&gt;i want output for the weekly time range inbetween and count between those date&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 01:17:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312588#M58576</guid>
      <dc:creator>DataOrg</dc:creator>
      <dc:date>2018-04-04T01:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312589#M58577</link>
      <description>&lt;P&gt;try &lt;CODE&gt;... | timechart span=1w max(count) as m_count&lt;/CODE&gt;&lt;BR /&gt;
hope i understood your question&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 01:33:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312589#M58577</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-04-04T01:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312590#M58578</link>
      <description>&lt;P&gt;how can i get timerange like this 2018/03/01 - 2018/03/07 in fields &lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 01:41:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312590#M58578</guid>
      <dc:creator>DataOrg</dc:creator>
      <dc:date>2018-04-04T01:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312591#M58579</link>
      <description>&lt;P&gt;not sure what exactly do you mean...&lt;BR /&gt;
if you mean that &lt;CODE&gt;2018/03/01 - 2018/03/07&lt;/CODE&gt; is a full string (value) of a field, lets call it &lt;CODE&gt;week&lt;/CODE&gt;&lt;BR /&gt;
you can maybe use something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1 | eval date = "2018/03/01 - 2018/03/07,2018/03/08 - 2018/03/14,2018/04/22 - 2018/04/28"
| makemv delim="," date
| mvexpand date
| rex field=date "(?&amp;lt;week_start&amp;gt;\d{4}\/\d{2}\/\d{2})\s+\-\s+(?&amp;lt;week_ends&amp;gt;\d{4}\/\d{2}\/\d{2})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can take it from there by converting to _time for timechart or play with it as you like&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 02:06:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312591#M58579</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-04-04T02:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312592#M58580</link>
      <description>&lt;P&gt;@premranjith, is this for report or dashboard?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 02:18:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312592#M58580</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-04T02:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312593#M58581</link>
      <description>&lt;P&gt;Try this!&lt;/P&gt;

&lt;P&gt;If everyday data exists ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval time=_time
|timechart span=1w count min(_time) as start max(_time) as end
|eval date=strftime(start,"%Y/%m/%d")+"-"+strftime(end,"%Y/%m/%d")
|table date count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When editing from _time&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|timechart span=1w count 
|eval date=strftime(_time,"%Y/%m/%d")+"-"+strftime(relative_time(_time,"+6d@d"),"%Y/%m/%d")
|table date count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2018 02:40:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312593#M58581</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-04-04T02:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312594#M58582</link>
      <description>&lt;P&gt;@premranjithj you can perform stats by number of the week of the year. You can do so by converting _time with either %U or %W modifier depending on whether you want Sunday or Monday to be the first day of the week.&lt;/P&gt;

&lt;P&gt;While performing stats one of the dates of the week needs to be captured. I have used &lt;CODE&gt;min(_time)&lt;/CODE&gt; , but you can use &lt;CODE&gt;max()&lt;/CODE&gt;, &lt;CODE&gt;earliest()&lt;/CODE&gt; or &lt;CODE&gt;latest()&lt;/CODE&gt; as any one would work. A date in the week is required for us to get Week Start and Week End Date using &lt;CODE&gt;relative_time&lt;/CODE&gt; which gives first day of the week using &lt;CODE&gt;@w&lt;/CODE&gt; (for Sunday as I have used &lt;CODE&gt;%U&lt;/CODE&gt; for stats which is also Sunday) and last day of week as Saturday using &lt;CODE&gt;+1w@w-1d&lt;/CODE&gt; (which is snap-to time to say move ahead to next week Sunday and select 1 day before which is Saturday of current week).&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4700i27055F641125CEC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;PS: You would notice from screenshot that some of the times your stats will not have events from the first day of week i.e. for the Week Of 03/04 - 03/10, the earliest time event is received is 03/05. However, using &lt;CODE&gt;relative_time()&lt;/CODE&gt; with snap to time gives us the requires Week Start and Week End Dates.&lt;/P&gt;

&lt;P&gt;Please try out the run anywhere search based on Splunk's _internal index and confirm:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd log_level!=INFO 
| eval WeekOfYear=strftime(_time,"%Y - %U") 
| stats count as Errors min(_time) as MinTime by WeekOfYear
| eval MinTime=strftime(MinTime,"%m/%d/%Y")
| eval WeekDateRange=strftime(relative_time(strptime(MinTime,"%m/%d/%Y"),"-0w@w"),"%m/%d/%Y")." - ".strftime(relative_time(strptime(MinTime,"%m/%d/%Y"),"+1w@w-1d"),"%m/%d/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;%U&lt;/STRONG&gt;  Week number of the year ( &lt;CODE&gt;Sunday as the first day of the week&lt;/CODE&gt;) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;%W&lt;/STRONG&gt;  Week number of the year ( &lt;CODE&gt;Monday as the first day of the week&lt;/CODE&gt;) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 04:42:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312594#M58582</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-04T04:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: time range to display count of weekly</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312595#M58583</link>
      <description>&lt;P&gt;@niketnilay .. thanks. it was working&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 04:58:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-range-to-display-count-of-weekly/m-p/312595#M58583</guid>
      <dc:creator>DataOrg</dc:creator>
      <dc:date>2018-04-04T04:58:45Z</dc:date>
    </item>
  </channel>
</rss>

