<?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: Graph the same time period but from 1 week previous in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253148#M75760</link>
    <description>&lt;P&gt;Above answer is for your question, and your comment referrers something else , any how this will helps you, &lt;/P&gt;

&lt;P&gt;Search, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source="/etc/httpd/logs/*"  host="$tableurlerror$" [|stats c | addinfo | eval earliest=info_min_time| eval latest=info_max_time | return earliest latest]  | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" |search status=40* OR status=50*  | eval when="Current"  |bin _time  |stats count as total by host,_time,when | streamstats c 
|append[ search  index=main source="/etc/httpd/logs/*"  host="$tableurlerror$"  [|stats c | addinfo | eval earliest=info_min_time-604800 | eval latest=info_max_time-604800 | return earliest latest]  | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" | eval when="Past" |bin _time   |stats count as total by host,_time,when | streamstats c ] | eval time=if(when="Current",_time,null) | sort 0 c | filldown time | eval _time=time | timechart sum(eval(if(when="Current",total ,0))) as totals1, sum(eval(if(when="Past",total ,0))) as totals2  by host | rename totals1* as Current*, totals2* as Past*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;take care of special chars - preferred to add this search by editing the dashboard panel - edit search &lt;/LI&gt;
&lt;LI&gt;Past week will not give you the date and time ( 08/29 as present that will be listed in x and 08/22 will not be shown in the mouse over&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Hope this will helps you. If so accept the answer. &lt;/P&gt;</description>
    <pubDate>Mon, 29 Aug 2016 20:12:55 GMT</pubDate>
    <dc:creator>vasanthmss</dc:creator>
    <dc:date>2016-08-29T20:12:55Z</dc:date>
    <item>
      <title>Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253142#M75754</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a query that looks like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;chart depends="$tableurlerror$"&amp;gt;
        &amp;lt;title&amp;gt;URL Errors by Host Details for - $tableurlerror$ for $field1.earliest$ to $field1.latest$&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;source="/etc/httpd/logs/*" index=main | rex "HTTP.\d.\d.\s+(?&amp;amp;lt;status&amp;amp;gt;\d+)" |search status=40* OR status=50*|where host="$tableurlerror$"  |timechart count by host&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$field1.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$field1.latest$&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It graphs all the &amp;gt;=40* and &amp;gt;=50* errors that occurred on a given host over the last 6 hours &lt;/P&gt;

&lt;P&gt;What I'd like to do is graph the same criteria, except it should be the same 6 hour period but from 1 week ago.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 15:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253142#M75754</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-08-29T15:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253143#M75755</link>
      <description>&lt;P&gt;I assume &lt;CODE&gt;field1&lt;/CODE&gt; is a timepicker. What should be the comparison if user picks &lt;CODE&gt;Last 7 days&lt;/CODE&gt; or  something else, that's not in hours?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 15:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253143#M75755</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-29T15:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253144#M75756</link>
      <description>&lt;P&gt;Hi Sundareshr,&lt;/P&gt;

&lt;P&gt;You are correct!  (always)  If the user selects the last 7 days then the graph should reflect that and the 7 days before.  Does that make sense?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 15:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253144#M75756</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-08-29T15:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253145#M75757</link>
      <description>&lt;P&gt;Try this ,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;chart depends="$tableurlerror$"&amp;gt;
         &amp;lt;title&amp;gt;URL Errors by Host Details for - $tableurlerror$ for $field1.earliest$ to $field1.latest$&amp;lt;/title&amp;gt;
         &amp;lt;search&amp;gt;
           &amp;lt;query&amp;gt;source="/etc/httpd/logs/*" index=main [|stats c | addinfo | eval earliest=info_min_time-604800 | eval latest=info_max_time-604800 | return earliest, latest] | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" |search status=40* OR status=50*|where host="$tableurlerror$"  |timechart count by host&amp;lt;/query&amp;gt;
           &amp;lt;earliest&amp;gt;$field1.earliest$&amp;lt;/earliest&amp;gt;
           &amp;lt;latest&amp;gt;$field1.latest$&amp;lt;/latest&amp;gt;
         &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;your query,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/etc/httpd/logs/*" index=main | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" |search status=40* OR status=50*|where host="$tableurlerror$"  |timechart count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;new query, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/etc/httpd/logs/*" index=main [|stats c | addinfo | eval earliest=info_min_time-604800 | eval latest=info_max_time-604800 | return earliest, latest] | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" |search status=40* OR status=50*|where host="$tableurlerror$"  |timechart count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;added new sub query to calculate earliest and latest (moving cursor to last 7 days),&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |stats c | addinfo | eval earliest=info_min_time-604800 | eval latest=info_max_time-604800 | return earliest, latest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this will helps you !!!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 16:00:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253145#M75757</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2016-08-29T16:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253146#M75758</link>
      <description>&lt;P&gt;Hi Vasanthmss,&lt;/P&gt;

&lt;P&gt;Many thanks for the reply!   I think I understand your query but its not quite doing what I hoped.   What I'm hoping to do is:&lt;/P&gt;

&lt;P&gt;Line graph series 1:&lt;BR /&gt;
The last 6 hours of values from today (8/29/2016) (example, 100, 200, 5, 10)&lt;/P&gt;

&lt;P&gt;Line graph series 2:&lt;BR /&gt;
The same 6 hours but from last Monday (8/22/2016) (example 50,30,200,300)&lt;/P&gt;

&lt;P&gt;Does that help?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 16:10:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253146#M75758</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-08-29T16:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253147#M75759</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/etc/httpd/logs/*" index=main [| search index=* earliest=$field1.earliest$ | head 1 | addinfo | eval earliest=relative_time(info_min_time, "-1w@w") | return earliest ] | eval when=if(_time&amp;lt;relative_time(now(), "$field1.earliest$"), "Previous", "Current") | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" |search status=40* OR status=50*|where host="$tableurlerror$"  |bin _time | eval t=_time."#".host | chart count by t when | rex field=t "(?&amp;lt;_time&amp;gt;[^#]+)#(?&amp;lt;host&amp;gt;.*)" | fields - t
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 16:35:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253147#M75759</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-29T16:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253148#M75760</link>
      <description>&lt;P&gt;Above answer is for your question, and your comment referrers something else , any how this will helps you, &lt;/P&gt;

&lt;P&gt;Search, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source="/etc/httpd/logs/*"  host="$tableurlerror$" [|stats c | addinfo | eval earliest=info_min_time| eval latest=info_max_time | return earliest latest]  | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" |search status=40* OR status=50*  | eval when="Current"  |bin _time  |stats count as total by host,_time,when | streamstats c 
|append[ search  index=main source="/etc/httpd/logs/*"  host="$tableurlerror$"  [|stats c | addinfo | eval earliest=info_min_time-604800 | eval latest=info_max_time-604800 | return earliest latest]  | rex "HTTP.\d.\d.\s+(?&amp;lt;status&amp;gt;\d+)" | eval when="Past" |bin _time   |stats count as total by host,_time,when | streamstats c ] | eval time=if(when="Current",_time,null) | sort 0 c | filldown time | eval _time=time | timechart sum(eval(if(when="Current",total ,0))) as totals1, sum(eval(if(when="Past",total ,0))) as totals2  by host | rename totals1* as Current*, totals2* as Past*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;take care of special chars - preferred to add this search by editing the dashboard panel - edit search &lt;/LI&gt;
&lt;LI&gt;Past week will not give you the date and time ( 08/29 as present that will be listed in x and 08/22 will not be shown in the mouse over&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Hope this will helps you. If so accept the answer. &lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 20:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253148#M75760</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2016-08-29T20:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253149#M75761</link>
      <description>&lt;P&gt;WOW!  What a query!!!!!  And.... it works great!!!!  Thank you vasanthmss!!!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 20:49:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253149#M75761</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-08-29T20:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253150#M75762</link>
      <description>&lt;P&gt;You can get rid of subsearch in the first query as you're just using the timerange picker values as it is anyways.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 20:57:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253150#M75762</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-29T20:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253151#M75763</link>
      <description>&lt;P&gt;@dbcase: are you sure the other query is the one you want??? &lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 15:52:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253151#M75763</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2016-08-30T15:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253152#M75764</link>
      <description>&lt;P&gt;Both of them worked so Ideally I would like to accept both answers!   &lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 15:59:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253152#M75764</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-08-30T15:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253153#M75765</link>
      <description>&lt;P&gt;This solution really should be advertised here. This is something that many people are wanting to do, me included, and the only other solutions were very cludgy and did not work with the timepicker very well.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 19:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253153#M75765</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2016-09-19T19:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Graph the same time period but from 1 week previous</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253154#M75766</link>
      <description>&lt;P&gt;I ended up using the the timewrap app&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 19:39:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Graph-the-same-time-period-but-from-1-week-previous/m-p/253154#M75766</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-09-19T19:39:01Z</dc:date>
    </item>
  </channel>
</rss>

