<?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: Calculations off of results of two stats searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126886#M34376</link>
    <description>&lt;P&gt;I was thinking that was the solution too but I am getting this message:&lt;/P&gt;

&lt;P&gt;Error in 'stats' command: The eval expression for dynamic field &lt;CODE&gt;eval(Status="Resolved" AND UserName=*adm*)&lt;/CODE&gt; is invalid. Error='The expression is malformed. An unexpected character is reached at '&lt;EM&gt;adm&lt;/EM&gt;'.'&lt;/P&gt;</description>
    <pubDate>Tue, 18 Nov 2014 21:40:10 GMT</pubDate>
    <dc:creator>hlarimer</dc:creator>
    <dc:date>2014-11-18T21:40:10Z</dc:date>
    <item>
      <title>Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126881#M34371</link>
      <description>&lt;P&gt;I have 2 searches:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=av_log sourcetype=sophos_threat_events | dedup ComputerName FullFilePath | stats count by ThreatType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search index=av_log sourcetype=sophos_threat_events Status = Resolved | dedup ComputerName FullFilePath | stats count by ThreatType  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Each search will create a results table showing 3 Threat types and a count for each.  The first search is totals, the second search are resolved.  I would like one table that would show each and show the percentage of Threats resolved for each ThreatType.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 20:30:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126881#M34371</guid>
      <dc:creator>hlarimer</dc:creator>
      <dc:date>2014-11-18T20:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126882#M34372</link>
      <description>&lt;P&gt;Hi hlarimer,&lt;/P&gt;

&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search index=av_log sourcetype=sophos_threat_events Status="Resolved" | dedup ComputerName FullFilePath | stats count(eval(Status="Resolved")) AS resolved_count count AS Total by ThreatType | eval perc=resolved_count*100/Total | table Total resolved_count ThreatType perch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Maybe you need to adapt this search a bit because it is not tested &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;cheers, Mus&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 20:40:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126882#M34372</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-18T20:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126883#M34373</link>
      <description>&lt;P&gt;Perhaps something like this will do the job.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=av_log sourcetype=sophos_threat_events | dedup ComputerName FullFilePath | stats count as ThreatCount by ThreatType | join ThreatType [search index=av_log sourcetype=sophos_threat_events Status = Resolved | dedup ComputerName FullFilePath | stats count as ResolvedCount by ThreatType] | table ThreatType ThreatCount ResolvedCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Nov 2014 20:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126883#M34373</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-11-18T20:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126884#M34374</link>
      <description>&lt;P&gt;I had to remove the Status="Resolved" from the initial search to start with the full results but otherwise this worked great (and removed a type from perc in the table command).  Thank you for this solution.&lt;/P&gt;

&lt;P&gt;An additional question, I would like to add an additional match to the eval (Status=Resolved) part of the search.  I would like to match Status=Matched and UserName!=&lt;EM&gt;adm&lt;/EM&gt;.  Any idea how to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:10:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126884#M34374</guid>
      <dc:creator>hlarimer</dc:creator>
      <dc:date>2014-11-18T21:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126885#M34375</link>
      <description>&lt;P&gt;Sure try this:&lt;/P&gt;

&lt;P&gt;eval(Status=Resolved OR Status=Matched AND UserName!=adm) &lt;/P&gt;

&lt;P&gt;And sorry for the typo &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; writting SPL on an iPad is not that easy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:18:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126885#M34375</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-18T21:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126886#M34376</link>
      <description>&lt;P&gt;I was thinking that was the solution too but I am getting this message:&lt;/P&gt;

&lt;P&gt;Error in 'stats' command: The eval expression for dynamic field &lt;CODE&gt;eval(Status="Resolved" AND UserName=*adm*)&lt;/CODE&gt; is invalid. Error='The expression is malformed. An unexpected character is reached at '&lt;EM&gt;adm&lt;/EM&gt;'.'&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:40:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126886#M34376</guid>
      <dc:creator>hlarimer</dc:creator>
      <dc:date>2014-11-18T21:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126887#M34377</link>
      <description>&lt;P&gt;sorry, format messed up in your comment.... so try this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval(Status="Resolved" AND UserName="*adm*")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:45:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126887#M34377</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-18T21:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations off of results of two stats searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126888#M34378</link>
      <description>&lt;P&gt;I'm not getting errors anymore but I'm still having issues with the last eval.  The following two searches should return the same results , correct?&lt;/P&gt;

&lt;P&gt;index=av_log sourcetype=sophos_threat_events  | dedup ComputerName FullFilePath | stats count(eval(UserName="&lt;EM&gt;adm&lt;/EM&gt;")) AS Resolved_by_Service_Desk&lt;/P&gt;

&lt;P&gt;index=av_log sourcetype=sophos_threat_events  | dedup ComputerName FullFilePath | search UserName=&lt;EM&gt;adm&lt;/EM&gt; | stats count AS Resolved_by_Service_Desk&lt;/P&gt;

&lt;P&gt;But the first result gives me 0 and the second gives me 44, any idea why?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculations-off-of-results-of-two-stats-searches/m-p/126888#M34378</guid>
      <dc:creator>hlarimer</dc:creator>
      <dc:date>2020-09-28T18:13:12Z</dc:date>
    </item>
  </channel>
</rss>

