<?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 How can I compare sum(bytes) in two time period using sub-search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-sum-bytes-in-two-time-period-using-sub-search/m-p/420542#M120858</link>
    <description>&lt;P&gt;Hi. im new to Splunk.&lt;/P&gt;

&lt;P&gt;I'm trying to compare the sum(bytes) for an hour ago, and the same hour one week before by certain field, and calculate the percentage change for these data. I have tried the following code, but the sum(bytes) it gives for doesn't match the actual value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xxx earliest=-60m latest=now | stats sum(bytes) as current by abc | appendcols [search index=xxx earliest=-1h@h-1w latest=@h-1w  | stats sum(bytes) as before by abc] | eval diff=current-before | eval percentagediff=round(abs(diff/before)*100,0) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that the current and the before values it returns are really off the actual value it should be at that time. &lt;BR /&gt;
May you guys please give me some ideas or suggestions of where could this go wrong?&lt;BR /&gt;
Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 21:17:42 GMT</pubDate>
    <dc:creator>everynameIwanti</dc:creator>
    <dc:date>2018-08-23T21:17:42Z</dc:date>
    <item>
      <title>How can I compare sum(bytes) in two time period using sub-search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-sum-bytes-in-two-time-period-using-sub-search/m-p/420542#M120858</link>
      <description>&lt;P&gt;Hi. im new to Splunk.&lt;/P&gt;

&lt;P&gt;I'm trying to compare the sum(bytes) for an hour ago, and the same hour one week before by certain field, and calculate the percentage change for these data. I have tried the following code, but the sum(bytes) it gives for doesn't match the actual value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xxx earliest=-60m latest=now | stats sum(bytes) as current by abc | appendcols [search index=xxx earliest=-1h@h-1w latest=@h-1w  | stats sum(bytes) as before by abc] | eval diff=current-before | eval percentagediff=round(abs(diff/before)*100,0) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that the current and the before values it returns are really off the actual value it should be at that time. &lt;BR /&gt;
May you guys please give me some ideas or suggestions of where could this go wrong?&lt;BR /&gt;
Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 21:17:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-sum-bytes-in-two-time-period-using-sub-search/m-p/420542#M120858</guid>
      <dc:creator>everynameIwanti</dc:creator>
      <dc:date>2018-08-23T21:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare sum(bytes) in two time period using sub-search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-sum-bytes-in-two-time-period-using-sub-search/m-p/420543#M120859</link>
      <description>&lt;P&gt;@everynameIwantistaken,&lt;/P&gt;

&lt;P&gt;Try something like this with your timerange settings. &lt;/P&gt;

&lt;P&gt;for the Subsearch do &lt;CODE&gt;earliest=-169h@h latest=-168h@h&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 22:02:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-sum-bytes-in-two-time-period-using-sub-search/m-p/420543#M120859</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-23T22:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare sum(bytes) in two time period using sub-search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-sum-bytes-in-two-time-period-using-sub-search/m-p/420544#M120860</link>
      <description>&lt;P&gt;it didn't work. I think is more like the search for the past even where out of place, like same event from last week can have 10times the sum(bytes) than the current values.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 15:53:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-sum-bytes-in-two-time-period-using-sub-search/m-p/420544#M120860</guid>
      <dc:creator>everynameIwanti</dc:creator>
      <dc:date>2018-08-24T15:53:19Z</dc:date>
    </item>
  </channel>
</rss>

