<?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: Get difference of occurence between 2 different day/months/years/date ranges in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562216#M195535</link>
    <description>&lt;P&gt;Yes, essentially what bin is doing is setting the field, _time in this instance, to the beginning of the period, e.g. month, week, day, hour, minute etc. Then the stats are gathered for that value. If you want different periods, then you could evaluate a field, e.g. _time based on whether it is before or after say 5th of month and set it to one value or another.&lt;/P&gt;&lt;P&gt;For alerts, just add a where command so that results are only returned when the threshold has been breached and set your alarm based on whether results exist&lt;/P&gt;</description>
    <pubDate>Thu, 05 Aug 2021 09:06:59 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-08-05T09:06:59Z</dc:date>
    <item>
      <title>Get difference of occurence between 2 different day/months/years/date ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562196#M195526</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;First post here - So I'm a Splunk beginner &amp;amp; recently got this tricky task.&lt;/P&gt;&lt;P&gt;So let's say I have these rows in my log file:&lt;/P&gt;&lt;P&gt;2020-01-01: error778&lt;BR /&gt;2020-01-02: error778&lt;BR /&gt;2020-01-03: error778&lt;BR /&gt;2020-01-16: error778&lt;BR /&gt;2020-02-01: error778&lt;BR /&gt;2020-02-04: error778&lt;BR /&gt;2020-02-06: error778&lt;BR /&gt;2020-02-10: error778&lt;BR /&gt;2020-02-18: error778&lt;BR /&gt;2020-02-19: error778&lt;/P&gt;&lt;P&gt;On Jan 2020, we can see that there are 4 rows of error778&lt;BR /&gt;On Feb 2020, we can see that there are 6 rows of error778&lt;BR /&gt;This means, from Jan 2020 to Feb 2020, there's 50% diff/increase of error778.&lt;BR /&gt;&lt;BR /&gt;The questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;How can I get/display the % difference? Ideally, the delimiters can be days, month, year, or date ranges (such as, diff of error778 between 1-5 Jan 2020 and 5-31 Jan 2020).&lt;/LI&gt;&lt;LI&gt;What's the best way to set an alert based on % (say, alert when diff is &amp;gt; 15%)?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I'm able to display the daily/weekly/monthly trend of a keyword using timechart like below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mylog "error778" | timechart span=1month count by date&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I believe it's far from what I need.&lt;/P&gt;&lt;P&gt;Any help would be appreciated, thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 07:40:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562196#M195526</guid>
      <dc:creator>isvnplunk</dc:creator>
      <dc:date>2021-08-05T07:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get difference of occurence between 2 different day/months/years/date ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562198#M195528</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=mylog "error778" 
| bin _time span=1mon
| stats count by _time
| streamstats values(count) as previous window=1 current=f
| eval diff=count-previous
| eval percent=100*diff/previous&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 Aug 2021 07:47:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562198#M195528</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-05T07:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get difference of occurence between 2 different day/months/years/date ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562200#M195529</link>
      <description>&lt;P&gt;Much appreciated,&amp;nbsp; &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;, it is very close to what I need.&lt;/P&gt;&lt;P&gt;I assume if it needs to be yearly or weekly or daily, I just need to switch the bin _time span from &lt;STRONG&gt;1mon&lt;/STRONG&gt; to &lt;STRONG&gt;1year/1day etc?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Would it very difficult to make it between some date ranges instead?&lt;/P&gt;&lt;P&gt;Also, now that we have the "percent" field, how do I create an alert based on this? Say, notify us if the percent of error is &amp;gt; 15%, for example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 07:59:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562200#M195529</guid>
      <dc:creator>isvnplunk</dc:creator>
      <dc:date>2021-08-05T07:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get difference of occurence between 2 different day/months/years/date ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562216#M195535</link>
      <description>&lt;P&gt;Yes, essentially what bin is doing is setting the field, _time in this instance, to the beginning of the period, e.g. month, week, day, hour, minute etc. Then the stats are gathered for that value. If you want different periods, then you could evaluate a field, e.g. _time based on whether it is before or after say 5th of month and set it to one value or another.&lt;/P&gt;&lt;P&gt;For alerts, just add a where command so that results are only returned when the threshold has been breached and set your alarm based on whether results exist&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 09:06:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562216#M195535</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-05T09:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get difference of occurence between 2 different day/months/years/date ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562217#M195536</link>
      <description>&lt;P&gt;Noted, will do as suggested, thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; !&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 09:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-difference-of-occurence-between-2-different-day-months-years/m-p/562217#M195536</guid>
      <dc:creator>isvnplunk</dc:creator>
      <dc:date>2021-08-05T09:11:24Z</dc:date>
    </item>
  </channel>
</rss>

