<?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: custom span in timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290351#M87787</link>
    <description>&lt;P&gt;For example, this is the desired result.&lt;BR /&gt;
However, performance etc are ignored.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;･･･ earliest=-7d@d latest=+1d@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week
|union [search ･･･ earliest=-14d@d latest=-7d@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
|union [search ･･･ earliest=-21d@d latest=-14d@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
|union [search ･･･ earliest=-28d@d latest=-21@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
|union [search ･･･ earliest=-35d@d latest=-28@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Nov 2017 05:53:34 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2017-11-21T05:53:34Z</dc:date>
    <item>
      <title>custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290345#M87781</link>
      <description>&lt;P&gt;Hi there,&lt;BR /&gt;
I have a set of events say 8 records. One record of particular date and other 7 records of past 7 days. when i am applying timechart on it with span=1w, I need to club the first 7 day as one week and 8th record as a separate week. &lt;/P&gt;

&lt;P&gt;For example:&lt;BR /&gt;
2017-09-12 &lt;BR /&gt;
2017-09-13 &lt;BR /&gt;
2017-09-14 &lt;BR /&gt;
2017-09-15 &lt;BR /&gt;
2017-09-16 &lt;BR /&gt;
2017-09-17 &lt;BR /&gt;
2017-09-18 &lt;BR /&gt;
2017-09-19   are 8 records.&lt;/P&gt;

&lt;P&gt;on applying span=1w  (for avg)&lt;BR /&gt;
I want records of:&lt;/P&gt;

&lt;P&gt;2017-09-12&lt;BR /&gt;
2017-09-19&lt;/P&gt;

&lt;P&gt;But it starts week from the first date in uploaded data source:&lt;/P&gt;

&lt;P&gt;2017-09-07&lt;BR /&gt;
2017-09-14&lt;/P&gt;

&lt;P&gt;here 2017-09-07 is first date in whole data source. (The 8 records i am getting after applying some conditions/filters on data source)&lt;/P&gt;

&lt;P&gt;Any help?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 09:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290345#M87781</guid>
      <dc:creator>dsiob</dc:creator>
      <dc:date>2017-11-20T09:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290346#M87782</link>
      <description>&lt;P&gt;@dsiob you should use &lt;BR /&gt;
1) Either your Time Picker input to pick only last 7 days (&lt;CODE&gt;-7d@d&lt;/CODE&gt;) including current date.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;earliest&amp;gt;-7d@d&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) Or directly apply earliest and latest to your base search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;YourBaseSearch&amp;gt; earliest="-7d@d" latest="now"
  | timechart span=1w avg(&amp;lt;YourFieldName&amp;gt;) as Avg_Field
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Nov 2017 14:28:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290346#M87782</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-20T14:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290347#M87783</link>
      <description>&lt;P&gt;Custom spans will require custom aggregation (regular timechart may not suffice). Could you post your current full search? Do you always get 8 rows and are they always start from yesterday to last 8 days?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 15:15:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290347#M87783</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-20T15:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290348#M87784</link>
      <description>&lt;P&gt;yeah, thats how I am filtreing records to get selected date and 7 days prev. records. That is coming, but it is not spaning that records only, It is taking whole records in count when clubing&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 04:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290348#M87784</guid>
      <dc:creator>dsiob</dc:creator>
      <dc:date>2017-11-21T04:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290349#M87785</link>
      <description>&lt;P&gt;If you want to break your events into separate weeks you can pipe your data into:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; | bin _time span=1d@w | timechart &amp;lt;data&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This breaks it into one day blocks, snapping to the start of the week.  Note that this uses the US definition of the start of the week (Sunday).  To use Monday as the start of the week, for example, you can use span=1d@w1.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 04:37:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290349#M87785</guid>
      <dc:creator>mtulett_splunk</dc:creator>
      <dc:date>2017-11-21T04:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290350#M87786</link>
      <description>&lt;P&gt;What is your data source? The dates mentioned in the question are _time field values or do you have Time stored in a different field?&lt;/P&gt;

&lt;P&gt;If you are not having data prior to last 7 days they should not show up in aggregated timechart. Not sure why they show up. Please share data and your SPL.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 05:46:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290350#M87786</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-21T05:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290351#M87787</link>
      <description>&lt;P&gt;For example, this is the desired result.&lt;BR /&gt;
However, performance etc are ignored.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;･･･ earliest=-7d@d latest=+1d@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week
|union [search ･･･ earliest=-14d@d latest=-7d@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
|union [search ･･･ earliest=-21d@d latest=-14d@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
|union [search ･･･ earliest=-28d@d latest=-21@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
|union [search ･･･ earliest=-35d@d latest=-28@d|eval  week=strftime(_time,"%Y-%m-%d")|stats count max(week) as week]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 05:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290351#M87787</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-11-21T05:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290352#M87788</link>
      <description>&lt;P&gt;HI&lt;/P&gt;

&lt;P&gt;Can you please try this search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval Date="2017-09-12" 
| append [ | makeresults | eval Date="2017-09-13"]
| append [ | makeresults | eval Date="2017-09-14"]
| append [ | makeresults | eval Date="2017-09-15"]
| append [ | makeresults | eval Date="2017-09-16"]
| append [ | makeresults | eval Date="2017-09-17"]
| append [ | makeresults | eval Date="2017-09-18"]
| append [ | makeresults | eval Date="2017-09-19"] 
| eval srno=1,Date=strptime(Date,"%Y-%m-%d") 
| accum srno 
| eval srno=floor(srno/8) 
| stats min(Date) as Date count by srno  | eval _time=Date 
| timechart avg(count) as average
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 15:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290352#M87788</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-21T15:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: custom span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290353#M87789</link>
      <description>&lt;P&gt;So here is the complete scenario:&lt;/P&gt;

&lt;P&gt;I had a single value panel with trend indicator. I have 3 months data for every day. It is showing current month avg and difference between latest two months. What I want is, when I select a date/date-range from date picker, It should show the difference between selected date and avg of one month before from the selected date. So the Trend indicator use timechart span in its query, so I asked before.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 10:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-span-in-timechart/m-p/290353#M87789</guid>
      <dc:creator>dsiob</dc:creator>
      <dc:date>2017-11-23T10:32:20Z</dc:date>
    </item>
  </channel>
</rss>

