<?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: Comparing time ranges one report in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75278#M4047</link>
    <description>&lt;P&gt;What you have looks right. I have two ideas:&lt;/P&gt;

&lt;P&gt;First, there are some versions of Splunk that do not happily let you re-compute _time in a subsearch. So, recompute it in the main search as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-1d@d latest=-0d@d 
| eval ReportKey="this week" 
| append maxtime=600 [search source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-8d@d latest=-7d@d
   | eval ReportKey="last week"] 
| eval _time=if(ReportKey=="last week",_time+60*60*24*7,_time)
| timechart span=5m avg(Value) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option #2 - Don't use a subsearch. This can get around other problems, such as very large datasets. (Although you might want to also consider summary indexing if your search runs for a long time.) It might also help with this problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-8d@d latest=-0d@d 
| eval ReportKey="deleteThisEvent"
| eval ReportKey=if(_time&amp;lt;=relative_time(now(),"-7d@d"),"SameDayLastWeek",ReportKey)
| eval ReportKey=if(_time&amp;gt;=relative_time(now(),"-1d@d"),"Yesterday",ReportKey)
| where ReportKey!="deleteThisEvent"
| eval _time=if(ReportKey=="last week",_time+60*60*24*7,_time)
| timechart fixedrange=false span=5m avg(Value) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The earliest means pick 8 days ago all the way up to yesterday at midnight.&lt;BR /&gt;
The first eval computes the full day of 7 days ago because of the earliest setting -7d@d up to -8d@d&lt;BR /&gt;
The second eval computes yesterday up to midnight because of the latest setting -1d@d up to -0d@d&lt;BR /&gt;
The rest "deleteThisEvent" gets rid of everything outside of those boundaries.&lt;/P&gt;</description>
    <pubDate>Sun, 30 Sep 2012 19:10:00 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2012-09-30T19:10:00Z</dc:date>
    <item>
      <title>Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75277#M4046</link>
      <description>&lt;P&gt;I'm trying to get Thursday of this week compared with Thursday of last week and have the values overlay in a stack graph.&lt;/P&gt;

&lt;P&gt;Using the following search, based off &lt;A href="http://blogs.splunk.com/2012/02/19/compare-two-time-ranges-in-one-report/"&gt;this link&lt;/A&gt;, I'm not able to get the data to overlap I can only get it working side by side.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-1d@d latest=-0d@d 
| eval ReportKey="this week" 
| append maxtime=600 [search source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-8d@d latest=-7d@d
   | eval _time=_time+60*60*24*7 
   | eval ReportKey="last week"] 
| timechart span=5m avg(Value) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What am I missing?&lt;/P&gt;

&lt;P&gt;Splunk Version 4.3.3&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2012 21:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75277#M4046</guid>
      <dc:creator>lspringer</dc:creator>
      <dc:date>2012-09-28T21:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75278#M4047</link>
      <description>&lt;P&gt;What you have looks right. I have two ideas:&lt;/P&gt;

&lt;P&gt;First, there are some versions of Splunk that do not happily let you re-compute _time in a subsearch. So, recompute it in the main search as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-1d@d latest=-0d@d 
| eval ReportKey="this week" 
| append maxtime=600 [search source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-8d@d latest=-7d@d
   | eval ReportKey="last week"] 
| eval _time=if(ReportKey=="last week",_time+60*60*24*7,_time)
| timechart span=5m avg(Value) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option #2 - Don't use a subsearch. This can get around other problems, such as very large datasets. (Although you might want to also consider summary indexing if your search runs for a long time.) It might also help with this problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-8d@d latest=-0d@d 
| eval ReportKey="deleteThisEvent"
| eval ReportKey=if(_time&amp;lt;=relative_time(now(),"-7d@d"),"SameDayLastWeek",ReportKey)
| eval ReportKey=if(_time&amp;gt;=relative_time(now(),"-1d@d"),"Yesterday",ReportKey)
| where ReportKey!="deleteThisEvent"
| eval _time=if(ReportKey=="last week",_time+60*60*24*7,_time)
| timechart fixedrange=false span=5m avg(Value) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The earliest means pick 8 days ago all the way up to yesterday at midnight.&lt;BR /&gt;
The first eval computes the full day of 7 days ago because of the earliest setting -7d@d up to -8d@d&lt;BR /&gt;
The second eval computes yesterday up to midnight because of the latest setting -1d@d up to -0d@d&lt;BR /&gt;
The rest "deleteThisEvent" gets rid of everything outside of those boundaries.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2012 19:10:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75278#M4047</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-09-30T19:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75279#M4048</link>
      <description>&lt;P&gt;The first option was successful. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2012 17:14:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75279#M4048</guid>
      <dc:creator>lspringer</dc:creator>
      <dc:date>2012-10-01T17:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75280#M4049</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My report is quite simirlar to this one but my idea is to build a timechart for the Domain user account lock outs from two days.&lt;/P&gt;

&lt;P&gt;The idea is to compare the user account lockouts (Event ID 644) difference between yesterday and today.&lt;/P&gt;

&lt;P&gt;I created the search but something goes wrong as I get less matchings than running the search separately.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="WinEventLog:Security" EventCode="644" earliest=-0d@d latest=now | eval ReportKey="today" | append [search sourcetype="WinEventLog:Security" EventCode="644" earliest=-1d@d latest=-0d@d | eval ReportKey="yesterday"] | eval _time=if(ReportKey=="yesterday",_time+86400,_time) | timechart span=120m c(EventCode) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 08:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75280#M4049</guid>
      <dc:creator>fedayn</dc:creator>
      <dc:date>2013-04-12T08:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75281#M4050</link>
      <description>&lt;P&gt;Any help with this, please.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2013 11:47:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75281#M4050</guid>
      <dc:creator>fedayn</dc:creator>
      <dc:date>2013-04-15T11:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75282#M4051</link>
      <description>&lt;P&gt;Make sure you are being timed out by a auto-finalized subsearch.&lt;/P&gt;

&lt;P&gt;Try:&lt;/P&gt;

&lt;P&gt;append maxtime=600[search sourcetype="WinEventLog:Security" EventCode="644" earliest=-1d@d latest=-0d@d&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2013 16:20:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75282#M4051</guid>
      <dc:creator>lspringer</dc:creator>
      <dc:date>2013-04-18T16:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75283#M4052</link>
      <description>&lt;P&gt;May I suggest that you open a different thread if you have a different problem? The original question is marked as "Answered" and that means that no one is expecting to find more questions here.&lt;/P&gt;

&lt;P&gt;That said, the following may help:&lt;/P&gt;

&lt;P&gt;The default number of results from a subsearch is 100; the maximum is 10499. To increase the number of results above the default of 100, you can edit limits.conf or use the &lt;CODE&gt;format&lt;/CODE&gt; command.&lt;BR /&gt;
My guess is that this is your problem. More info at the following link&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.2/Search/Aboutsubsearches"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.2/Search/Aboutsubsearches&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2013 17:46:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75283#M4052</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-04-22T17:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75284#M4053</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Comparing week-over-week results is a pain in Splunk. You have to do absurd math for crazy date calculations. No more.  Now there is a better way.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I wrote a convenient search command called "timewrap" that does it all, for arbitrary time periods.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://apps.splunk.com/app/1645/" target="test_blank"&gt;http://apps.splunk.com/app/1645/&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Dec 2013 21:19:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75284#M4053</guid>
      <dc:creator>carasso</dc:creator>
      <dc:date>2013-12-06T21:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75285#M4054</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Comparing week-over-week results used to a pain in Splunk, with complex date calculations. No more.  Now there is a better way.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I wrote a convenient search command called "&lt;A href="http://apps.splunk.com/app/1645/"&gt;timewrap&lt;/A&gt;" that does it all, for arbitrary time periods.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Perfmon:CPU Load" counter="% Processor Time" host="SERVER01" earliest=-1d@d latest=-0d@d 
| timechart avg(Value) span=1h 
| timewrap w 
| where strftime(_time, "%A") == "Thursday"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;That's it!&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://apps.splunk.com/app/1645/"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;A href="http://apps.splunk.com/app/1645/" target="test_blank"&gt;http://apps.splunk.com/app/1645/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2013 21:47:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75285#M4054</guid>
      <dc:creator>carasso</dc:creator>
      <dc:date>2013-12-06T21:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75286#M4055</link>
      <description>&lt;P&gt;Can you use timewrap to populate a single value visualization with trend indicator?  For instance I want the last 7 days to populate the single value and the week before that to be fed into the trend indicator.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 14:28:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75286#M4055</guid>
      <dc:creator>rdeloach</dc:creator>
      <dc:date>2016-08-30T14:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing time ranges one report</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75287#M4056</link>
      <description>&lt;P&gt;Here is a much more elegant solution which can plot all days on the same day in timechart and does not require the use of an app:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval series=strftime(_time, "%m-%d") | eval time_delta=(now-_time)/86400,time_day=ceiling(time_delta),_time=_time+time_day*86400 | eval day=case(time_day=0,"Today",time_day=1,"Yesterday",time_day=8,"SD last week") | timechart fixedrange=false sum(count) by day
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This allows you to plot any time range by series or to assign nice names in the case statement to each day based on its relation to the current time/day.  86400 is the number of seconds in a day.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 18:22:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Comparing-time-ranges-one-report/m-p/75287#M4056</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2017-08-07T18:22:59Z</dc:date>
    </item>
  </channel>
</rss>

