<?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: Do math on this period's numbers versus last period's in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454456#M128575</link>
    <description>&lt;P&gt;Check out the following using extreme search to create a baseline and identify when performance doesn't match the baseline:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.georgestarcher.com/splunk-getting-extreme-part-one/"&gt;http://www.georgestarcher.com/splunk-getting-extreme-part-one/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2019 13:51:17 GMT</pubDate>
    <dc:creator>solarboyz1</dc:creator>
    <dc:date>2019-08-20T13:51:17Z</dc:date>
    <item>
      <title>Do math on this period's numbers versus last period's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454455#M128574</link>
      <description>&lt;P&gt;I'd like to build an alert that essentially says "if the count from this hour is more than twice, or less than half, the count from the last hour, throw an alert." I'm new to Splunk, and I'm having a hard time figuring out how to write this. Obviously I've got the count part—using &lt;CODE&gt;stats count&lt;/CODE&gt; or &lt;CODE&gt;timechart count&lt;/CODE&gt; or whatever. That gives me a relatively compact table, with a double-digit number of rows. Now I essentially want to join that table to itself. If this were SQL, I would find it trivial; it'd be a quick self-join. I can't figure out how to encode it in Splunk. Is there an easy way to do this?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;timewrap&lt;/CODE&gt; looked promising, but I couldn't figure out how to take just this hour's count and divide by just the last hour's count. Instead &lt;CODE&gt;timewrap&lt;/CODE&gt; gave me a bunch of columns, including an hour ago but also many other hours ago.&lt;/P&gt;

&lt;P&gt;Does this problem have an obvious answer?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 13:22:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454455#M128574</guid>
      <dc:creator>shulmaniel</dc:creator>
      <dc:date>2019-08-20T13:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Do math on this period's numbers versus last period's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454456#M128575</link>
      <description>&lt;P&gt;Check out the following using extreme search to create a baseline and identify when performance doesn't match the baseline:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.georgestarcher.com/splunk-getting-extreme-part-one/"&gt;http://www.georgestarcher.com/splunk-getting-extreme-part-one/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 13:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454456#M128575</guid>
      <dc:creator>solarboyz1</dc:creator>
      <dc:date>2019-08-20T13:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Do math on this period's numbers versus last period's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454457#M128576</link>
      <description>&lt;P&gt;That feels like a sledgehammer to kill an ant. Am I misreading it?&lt;/P&gt;

&lt;P&gt;Fundamentally, too, I don't think I'm doing an anomaly-detection task; I should be able to just do math using both this period and another period. No? In SQL, this would be trivial using basic arithmetic; it wouldn't require any extra machinery.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 13:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454457#M128576</guid>
      <dc:creator>shulmaniel</dc:creator>
      <dc:date>2019-08-20T13:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Do math on this period's numbers versus last period's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454458#M128577</link>
      <description>&lt;P&gt;Check out &lt;CODE&gt;relative_time&lt;/CODE&gt; or the &lt;CODE&gt;date_hour&lt;/CODE&gt; field. Either will work &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=.. 
| timechart count 
| eval now=now()
| eval one_hour_ago=relative_time(now(), "-1h")
| eval compare_this_hour_to_last=if(_time&amp;gt;one_hour_ago AND _time&amp;lt;now, 'count',"") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Aug 2019 14:46:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-math-on-this-period-s-numbers-versus-last-period-s/m-p/454458#M128577</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2019-08-20T14:46:49Z</dc:date>
    </item>
  </channel>
</rss>

