<?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: Compare two counts from two time searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321087#M95924</link>
    <description>&lt;P&gt;Could only accept one answer, but this worked also!&lt;/P&gt;

&lt;P&gt;Can you please explain to me what the "streamstats count as row" bit is doing?&lt;BR /&gt;
And the "xyseries source row count" row?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2017 18:04:22 GMT</pubDate>
    <dc:creator>smcdonald20</dc:creator>
    <dc:date>2017-02-21T18:04:22Z</dc:date>
    <item>
      <title>Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321084#M95921</link>
      <description>&lt;P&gt;I need to be able to find the difference between two "Count" values; the count for today, and the count yesterday.&lt;/P&gt;

&lt;P&gt;My search:&lt;BR /&gt;
index=ad source=otl_adcomputerscan &lt;BR /&gt;
| stats count by source, reportTime  &lt;/P&gt;

&lt;P&gt;This gives me results similar to below:&lt;/P&gt;

&lt;P&gt;Source---------------- ReportTime      Count&lt;BR /&gt;
otl_adcomputerscan     2017-02-20       16070&lt;BR /&gt;
otl_adcomputerscan     2017-02-21       16088&lt;/P&gt;

&lt;P&gt;I want to be able to find the difference between the count today, and the count yesterday.&lt;BR /&gt;
What is the best way to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321084#M95921</guid>
      <dc:creator>smcdonald20</dc:creator>
      <dc:date>2020-09-29T13:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321085#M95922</link>
      <description>&lt;P&gt;Assuming you always want to compare today with yesterday, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ad source=otl_adcomputerscan | eval reportTime=if(strptime(reportTime,"%Y-%m-%d")&amp;gt;=relative_time(now(),"@d"),"Today","Yesterday")
| chart count over source by reportTime | eval differecence=Today-Yesterday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2017 16:24:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321085#M95922</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-02-21T16:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321086#M95923</link>
      <description>&lt;P&gt;Add this to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats count AS row
| eval row="row" . row
| xyseries source row count
| eval delta=row2-row1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2017 16:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321086#M95923</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-02-21T16:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321087#M95924</link>
      <description>&lt;P&gt;Could only accept one answer, but this worked also!&lt;/P&gt;

&lt;P&gt;Can you please explain to me what the "streamstats count as row" bit is doing?&lt;BR /&gt;
And the "xyseries source row count" row?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 18:04:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321087#M95924</guid>
      <dc:creator>smcdonald20</dc:creator>
      <dc:date>2017-02-21T18:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321088#M95925</link>
      <description>&lt;P&gt;The &lt;CODE&gt;streamstats&lt;/CODE&gt; adds a &lt;CODE&gt;row&lt;/CODE&gt; field to each row; &lt;CODE&gt;xyseries&lt;/CODE&gt; converts a column to a string of rows (which is what &lt;CODE&gt;chart&lt;/CODE&gt; is also doing in the other answer).  Add the piped commands one-by-one to see what each does.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 18:21:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321088#M95925</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-02-21T18:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321089#M95926</link>
      <description>&lt;P&gt;If you like to get credits to a good answer, up vote it.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 18:36:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321089#M95926</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2017-02-21T18:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321090#M95927</link>
      <description>&lt;P&gt;I realized that this is even easier; add this to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| delta count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2017 18:49:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321090#M95927</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-02-21T18:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321091#M95928</link>
      <description>&lt;P&gt;...experiencing the pain that comes with stubbing your toe on the obvious solution...&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 21:57:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321091#M95928</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-21T21:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321092#M95929</link>
      <description>&lt;P&gt;This is great! This will give me a list of delta's, how do I always use the most recent delta?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 10:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321092#M95929</guid>
      <dc:creator>smcdonald20</dc:creator>
      <dc:date>2017-02-22T10:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two counts from two time searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321093#M95930</link>
      <description>&lt;P&gt;You can use either &lt;CODE&gt;sort&lt;/CODE&gt; or &lt;CODE&gt;reverse&lt;/CODE&gt; to change the order and use &lt;CODE&gt;head&lt;/CODE&gt; or &lt;CODE&gt;tail&lt;/CODE&gt; to keep only the top/last row.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 15:57:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-counts-from-two-time-searches/m-p/321093#M95930</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-02-22T15:57:15Z</dc:date>
    </item>
  </channel>
</rss>

