<?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: Today count match with same day in last week and prior week in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381662#M168023</link>
    <description>&lt;P&gt;@niketnilay Thanks for you answer and its almost working fine but i would like to include prior week same day (before week of last week same day) as well.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Aug 2018 07:37:05 GMT</pubDate>
    <dc:creator>john_q</dc:creator>
    <dc:date>2018-08-01T07:37:05Z</dc:date>
    <item>
      <title>Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381660#M168021</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;

&lt;P&gt;Below is my search,&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index=something source=something "error" | stats count&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I want to create an alert for today count compare with the same day in last week and prior week and make sure that count should be match with 20%(-/+). &lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 05:14:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381660#M168021</guid>
      <dc:creator>john_q</dc:creator>
      <dc:date>2018-08-01T05:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381661#M168022</link>
      <description>&lt;P&gt;@john_q try the following run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd log_level!="INFO" earliest=-0d@d latest=now
| stats count as Today
| appendcols [search index=_internal sourcetype=splunkd log_level!="INFO" earliest=-7d@d latest=-7d@s
| stats count as LastWeekSameDay]
| eval perc=abs(round(((LastWeekSameDay-Today)/LastWeekSameDay)*100,2))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use &lt;CODE&gt;search perc&amp;gt;20&lt;/CODE&gt; as &lt;STRONG&gt;Alert Trigger Condition&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;From Dashboard perspective do check out following Splunk Blog: &lt;A href="https://www.splunk.com/blog/2012/02/19/compare-two-time-ranges-in-one-report.html"&gt;https://www.splunk.com/blog/2012/02/19/compare-two-time-ranges-in-one-report.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also one of recent commands introduced in Splunk 6.5: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Timewrap"&gt;Timewrap&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 06:02:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381661#M168022</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-01T06:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381662#M168023</link>
      <description>&lt;P&gt;@niketnilay Thanks for you answer and its almost working fine but i would like to include prior week same day (before week of last week same day) as well.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 07:37:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381662#M168023</guid>
      <dc:creator>john_q</dc:creator>
      <dc:date>2018-08-01T07:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381663#M168024</link>
      <description>&lt;P&gt;Sorry so if today is Wed 08/01/2018, what is the other date you need to pick?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 08:02:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381663#M168024</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-01T08:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381664#M168025</link>
      <description>&lt;P&gt;same Wednesday only in last week and prior week&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 08:15:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381664#M168025</guid>
      <dc:creator>john_q</dc:creator>
      <dc:date>2018-08-01T08:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381665#M168026</link>
      <description>&lt;P&gt;Is this correct???&lt;/P&gt;

&lt;P&gt;index=_internal sourcetype=splunkd log_level!="INFO" earliest=-0d@d latest=now&lt;BR /&gt;
 | stats count as Today&lt;BR /&gt;
 | appendcols [search index=_internal sourcetype=splunkd log_level!="INFO" earliest=-7d@d latest=-6d@d&lt;BR /&gt;
 | stats count as LastWeekSameDay]&lt;BR /&gt;
| appendcols [search index=_internal sourcetype=splunkd log_level!="INFO" earliest=-14d@d latest=-13d@d&lt;BR /&gt;
 | stats count as PriorWeekSameDay]&lt;BR /&gt;
 | eval perc=abs(round(((PriorWeekSameDay-LastWeekSameDay-Today)/PriorWeekSameDay)*100,2))&lt;/P&gt;

&lt;P&gt;Expecting output:&lt;/P&gt;

&lt;P&gt;Today     LastWeekSameDay      PriorWeekSameDay             Perc&lt;BR /&gt;
   20                                                       120                               3649                                       8x.xx&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:42:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381665#M168026</guid>
      <dc:creator>john_q</dc:creator>
      <dc:date>2020-09-29T20:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381666#M168027</link>
      <description>&lt;P&gt;How to add prior week same day as well and calculate data percentage for 3days ??? Can you please tell me??&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2018 05:31:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381666#M168027</guid>
      <dc:creator>john_q</dc:creator>
      <dc:date>2018-08-02T05:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381667#M168028</link>
      <description>&lt;P&gt;@niketnilay actually i am looking for 3 days data comparison perc like today Thursday (08/02/2018) right as per IST. So we should compare with 07/26/2018 and 07/19/2018. 3 days data count percentage difference ?? Can you please let me know ??&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2018 05:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381667#M168028</guid>
      <dc:creator>john_q</dc:creator>
      <dc:date>2018-08-02T05:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Today count match with same day in last week and prior week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381668#M168029</link>
      <description>&lt;P&gt;@john_q, while appendcols seems correct, I dont think percent works the way you have calculated (unless that is what you want). You should have two separate percent calculated with Today's volume as compared for each of the two previous weeks. Try the following and see if it fits your needs!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd log_level!="INFO" earliest=-0d@d latest=now 
| stats count as Today 
| appendcols 
    [ search index=_internal sourcetype=splunkd log_level!="INFO" earliest=-7d@d latest=-6d@d 
    | stats count as OneWeekAgoSameDay] 
| appendcols 
    [ search index=_internal sourcetype=splunkd log_level!="INFO" earliest=-14d@d latest=-13d@d 
    | stats count as TwoWeeksAgoSameDay] 
| foreach *SameDay 
    [| eval Perc&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;=round(((&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;-Today)/&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;)*100,2)]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Aug 2018 16:24:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-count-match-with-same-day-in-last-week-and-prior-week/m-p/381668#M168029</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-04T16:24:23Z</dc:date>
    </item>
  </channel>
</rss>

