<?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: How do I edit my timechart search with timewrap to compare the latest 2 hours with the same 2 hours 3 days ago? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270345#M31343</link>
    <description>&lt;P&gt;Hi lads,&lt;/P&gt;

&lt;P&gt;I am trying to do a timechart for multiple panels showing trendlines. So at the end of most of my panels i am just counting the count using stats count. I want to show the difference between this reading in the last 12 hours with the previous day or something that will show me that my calculations in parameters and so i know if the log files goes down etc. thanks&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2017 15:15:33 GMT</pubDate>
    <dc:creator>colinmchugo</dc:creator>
    <dc:date>2017-07-12T15:15:33Z</dc:date>
    <item>
      <title>How do I edit my timechart search with timewrap to compare the latest 2 hours with the same 2 hours 3 days ago?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270341#M31339</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Sorry if this has been answered before, however, I am struggling with a search that I am trying to build.&lt;/P&gt;

&lt;P&gt;The ideal result that I am trying to achieve is the following:&lt;/P&gt;

&lt;P&gt;I want a time chart to display the last two hours for a field like duration. In addition to showing the last two hours, I want it to show the same hours, but for the previous 3 days. Therefore, I want to compare the recent/latest two hours with those of the previous days.&lt;/P&gt;

&lt;P&gt;I thought I could achieve this with the timewrap app, but I am struggling to write the search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" 
[stats count | eval earliest="-4d" | fields earliest]
[stats count | eval latest="now" | fields latest] 
| timechart avg(duration)
| timewrap d
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please let me know if I have not provided enough information.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 16:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270341#M31339</guid>
      <dc:creator>mattusr</dc:creator>
      <dc:date>2015-12-11T16:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my timechart search with timewrap to compare the latest 2 hours with the same 2 hours 3 days ago?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270342#M31340</link>
      <description>&lt;P&gt;I have reworked a few things, but try this.&lt;/P&gt;

&lt;P&gt;NOTE that I have a gap in MY events (it's just my test/home system) from 96 to 98 hours ago, so I had to use a somewhat different time frame then adjust it back - it MAY take a little tweaking to get just right but I think this is it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" earliest=-98h@h latest=-96h@h 
| append [search index="main" earliest=-2h@h latest=@h]
| timechart span=2h count 
| timewrap h series=short 
| eval percent_difference = 's1'/'s-95'*100 
| rename s-95 AS 4_days_ago s1 AS today
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The big difference is I use the hourly timeframe of -96 to -98 hours ago for my "4 days ago" - so I'm taking now - 4 days (snapped to the hour) as my latest, then going back 2 more hours so that I have the most "aligned" time frame, then appending to that data that from the last 2 hours (also snapped to the hour to make the match as good as possible).&lt;/P&gt;

&lt;P&gt;Then I timechart it into 2h chunks, then timewrap it by hours (not days - days will separate these out onto two lines for reasons to lengthy even for me to get into here) to get your two fields.  I tossed in, free of any extra charge, a freebie that finds the percentage difference between the two sums, so lucky you!  Then I just rename some things.&lt;/P&gt;

&lt;P&gt;BTW, no guarantees this will not be off by an hour during the 4 days the 4-day period involved spans a daylight savings time change.  In fact, I know the "96 hours ago" will be off by one hour during those few days.  Not sure how to fix that easily.&lt;/P&gt;

&lt;P&gt;There are other methods available, but I think because of the small time frames so widely separated that this is better than most of the others.  &lt;/P&gt;</description>
      <pubDate>Sat, 12 Dec 2015 03:07:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270342#M31340</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-12-12T03:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my timechart search with timewrap to compare the latest 2 hours with the same 2 hours 3 days ago?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270343#M31341</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Thank you so much for a response, I have been away so finally got to test in our production environment.&lt;/P&gt;

&lt;P&gt;I am struggling with the search.&lt;/P&gt;

&lt;P&gt;To make it clearer would you be able to incorporate the following into your example&lt;/P&gt;

&lt;P&gt;Trying to timechart field (time_taken) and want to timechart the average so avg(time_taken)&lt;/P&gt;

&lt;P&gt;Hope this make sense!&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:18:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270343#M31341</guid>
      <dc:creator>mattusr</dc:creator>
      <dc:date>2020-09-29T08:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my timechart search with timewrap to compare the latest 2 hours with the same 2 hours 3 days ago?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270344#M31342</link>
      <description>&lt;P&gt;I just saw this comment - nearly a year later!  Sorry!&lt;/P&gt;

&lt;P&gt;I am not quite sure I follow, though perhaps I do but don't understand how it would work.  Still, if I had to make a guess try changing the &lt;CODE&gt;timechart&lt;/CODE&gt; in the above to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timechart sum(time_taken) as total_time_taken, avg(time_taken) as avg_time_taken
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then just follow on with everything else.  There are sure to be other minor adjustments, but that should get you started.&lt;/P&gt;

&lt;P&gt;If that's not what you need, and you need this question still answered, please reply back with more information!&lt;/P&gt;

&lt;P&gt;On the other hand, if this is resolved now and if this helped you significantly, please "Accept" the answer.  If this is resolved but my answer didn't help a whole lot, it would be great if you could post your &lt;EM&gt;own&lt;/EM&gt; answer then mark that one accepted!&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Rich &lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 01:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270344#M31342</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-01-04T01:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my timechart search with timewrap to compare the latest 2 hours with the same 2 hours 3 days ago?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270345#M31343</link>
      <description>&lt;P&gt;Hi lads,&lt;/P&gt;

&lt;P&gt;I am trying to do a timechart for multiple panels showing trendlines. So at the end of most of my panels i am just counting the count using stats count. I want to show the difference between this reading in the last 12 hours with the previous day or something that will show me that my calculations in parameters and so i know if the log files goes down etc. thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-edit-my-timechart-search-with-timewrap-to-compare-the/m-p/270345#M31343</guid>
      <dc:creator>colinmchugo</dc:creator>
      <dc:date>2017-07-12T15:15:33Z</dc:date>
    </item>
  </channel>
</rss>

