<?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: Calculate percentage b/n 2 counted numbers in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383033#M111901</link>
    <description>&lt;P&gt;Thank you very much. That's awesome!&lt;/P&gt;</description>
    <pubDate>Fri, 15 Feb 2019 11:54:01 GMT</pubDate>
    <dc:creator>swimena</dc:creator>
    <dc:date>2019-02-15T11:54:01Z</dc:date>
    <item>
      <title>Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383026#M111894</link>
      <description>&lt;P&gt;Hello everyone, &lt;/P&gt;

&lt;P&gt;I'm trying to calculate the % of overdue items and print the result for every month. It looks like I'm completely stuck with the query so any help will be greatly appreciated. &lt;/P&gt;

&lt;P&gt;Here's what I'm trying to achieve:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Select entries with every 4 and 5 for the last month&lt;/LI&gt;
&lt;LI&gt;calculate the days difference between 2 days to get the overdue days&lt;/LI&gt;
&lt;LI&gt;count only items that are 30+ days overdue&lt;/LI&gt;
&lt;LI&gt;count the total amount of items&lt;/LI&gt;
&lt;LI&gt;calculate the percentage&lt;/LI&gt;
&lt;LI&gt;print it in a table and get the % for every month for comparison&lt;/LI&gt;
&lt;LI&gt;possibly visualize the results in a Area Chart&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;...........&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=something (SEVERITY=4 OR SEVERITY=5) earliest=-4w@w latest=now 
    | eval start=FIRST_FOUND_DATETIME| eval end=LAST_FOUND_DATETIME| eval duration = round((end-start)/86400)
    | stats count, values(round) AS Overdue
    | where round&amp;gt;30
    | stats count as Total
    | eval percent_difference=((Overdue/Total)*100) 
    | table percent_difference
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Feb 2019 12:18:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383026#M111894</guid>
      <dc:creator>swimena</dc:creator>
      <dc:date>2019-02-14T12:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383027#M111895</link>
      <description>&lt;P&gt;We need more information on how to determine FIRST_FOUND_DATETIME. Are there multiple events per ticket? If so, what field name is used to determine two events are for the same ticket?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:17:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383027#M111895</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2020-09-29T23:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383028#M111896</link>
      <description>&lt;P&gt;Hi Chris, &lt;/P&gt;

&lt;P&gt;This is a feed from a vulnerability scanner. Each event may have several dates and the format of the log is the following (per event): &lt;/P&gt;

&lt;P&gt;IP  DNS NetBIOS Tracking Method OS  IP Status Title Vuln Status Type    Severity    Port    Protocol    FQDN    First Detected  Last Detected   Times Detected  Date Last Fixed CVE ID&lt;/P&gt;

&lt;P&gt;I'm trying to calculate the days difference b/n first and last detected for each vulnerability for each host. &lt;BR /&gt;
Then I want to extract only those events which days difference is higher than 30 and count their number. The last step would be to compare the count of those 30+ events to the count of the total number of events and find their ratio (%). I also would like to visualize the results for every month. &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 06:48:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383028#M111896</guid>
      <dc:creator>swimena</dc:creator>
      <dc:date>2019-02-15T06:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383029#M111897</link>
      <description>&lt;P&gt;Hi @swimena &lt;/P&gt;

&lt;P&gt;Your query is on the right trach, yet you might be missing a few points here. First, please check and confirm, that your fields &lt;CODE&gt;FIRST_FOUND_DATETIME&lt;/CODE&gt; and &lt;CODE&gt;LAST_FOUND_DATETIME&lt;/CODE&gt; are timestamp fields (UNIX time), and not time strings - because if you want to calculate a duration, these need to be a number format. &lt;/P&gt;

&lt;P&gt;For the example I am assuming these are strings formatted "YYYY-MM-DD HH:MM:SS" - if it is different in your case, please adjust the &lt;CODE&gt;strptime&lt;/CODE&gt; accordingly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=something (SEVERITY=4 OR SEVERITY=5) earliest=-4w@w latest=now
| eval start = strptime(FIRST_FOUND_DATETIME,"%Y-%m-%d %H:%M:%S")
| eval end = strptime(LAST_FOUND_DATETIME,"%Y-%m-%d %H:%M:%S")
| eval duration = round((end-start)/86400)
| stats count as Total, count(eval(duration&amp;gt;30)) as Overdue
| eval percentage = ((Overdue/Total)*100)
| table Total Overdue percentage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Feb 2019 07:24:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383029#M111897</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2019-02-15T07:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383030#M111898</link>
      <description>&lt;P&gt;Hi @DMohn, &lt;/P&gt;

&lt;P&gt;This works like a charm. Readjusted the time as per your advice.&lt;/P&gt;

&lt;P&gt;Thank you very much for your help!&lt;/P&gt;

&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 07:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383030#M111898</guid>
      <dc:creator>swimena</dc:creator>
      <dc:date>2019-02-15T07:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383031#M111899</link>
      <description>&lt;P&gt;Just remembered to ask - do you know how I can print the calculated percentage for the last 3 months and split by month - Nov/Dec/Jan? &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 08:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383031#M111899</guid>
      <dc:creator>swimena</dc:creator>
      <dc:date>2019-02-15T08:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383032#M111900</link>
      <description>&lt;P&gt;You can do this with the same query - almost &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=something (SEVERITY=4 OR SEVERITY=5) earliest=-3m@m latest=@m
 | eval start = strptime(FIRST_FOUND_DATETIME,"%Y-%m-%d %H:%M:%S")
 | eval end = strptime(LAST_FOUND_DATETIME,"%Y-%m-%d %H:%M:%S")
 | eval duration = round((end-start)/86400)
 | eval month = strftime(_time,"$y/%m")
 | stats count as Total, count(eval(duration&amp;gt;30)) as Overdue by month
 | eval percentage = ((Overdue/Total)*100)
 | table month percentage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;month&lt;/CODE&gt; being formatted as YY/MM here, because if you were using the month name only, sorting could be off.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 08:57:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383032#M111900</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2019-02-15T08:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383033#M111901</link>
      <description>&lt;P&gt;Thank you very much. That's awesome!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 11:54:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383033#M111901</guid>
      <dc:creator>swimena</dc:creator>
      <dc:date>2019-02-15T11:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate percentage b/n 2 counted numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383034#M111902</link>
      <description>&lt;P&gt;Hi ,  splunk fundamental elearning retest . can I take immediately after failing the first or I need to wait for 2 to 3 days to retake&lt;BR /&gt;
,hi I have failed in splunk fundamental e1. I took the test again. cleared the test, but scores not reflected . it included the time I spend for the retake and shows the result as fail, any time period is required taking retest.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 07:11:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-percentage-b-n-2-counted-numbers/m-p/383034#M111902</guid>
      <dc:creator>devastephen</dc:creator>
      <dc:date>2019-07-09T07:11:59Z</dc:date>
    </item>
  </channel>
</rss>

