<?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: Eval results and remove results based on conditions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47885#M11430</link>
    <description>&lt;P&gt;Thanks jonuwz, I'll do some playing around with that.&lt;/P&gt;

&lt;P&gt;I found this article when I noticed that 'latest()' wasn't returning any results:&lt;BR /&gt;
&lt;A href="http://splunk-base.splunk.com/answers/42084/latest-function-in-stats-not-working-without-earliest"&gt;http://splunk-base.splunk.com/answers/42084/latest-function-in-stats-not-working-without-earliest&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;One other thing I noticed, which was causing me some grief, was that I was including 'Status' in the stats, so this was also causing me to see results which were unwanted.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Aug 2012 15:15:29 GMT</pubDate>
    <dc:creator>ARothman</dc:creator>
    <dc:date>2012-08-31T15:15:29Z</dc:date>
    <item>
      <title>Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47881#M11426</link>
      <description>&lt;P&gt;The goal of my search is to&lt;/P&gt;

&lt;P&gt;1) display the details&lt;/P&gt;

&lt;P&gt;2) show the count of viruses which have not been handled by our anti-virus&lt;/P&gt;

&lt;P&gt;I will give examples of the fields I am concerned over and how I would like this to work below:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;EventID="390730"; EventType="Viruses/spyware"; Action="Blocked"; ComputerName="MYCOMPUTER1"; EventTime="EARLIER DATE/TIME"; Status="Cleanable"; EventName="VIRUS1";&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;EventID="390739"; EventType="Viruses/spyware"; Action="Cleaned up"; ComputerName="MYCOMPUTER1";  EventTime="LATER DATE/TIME"; Status="Resolved"; EventName="VIRUS1";&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;So, I've realized I'm going to have to do a sub-search, but I can't quite understand how I would go about doing it.  I want to be able to completely remove search results if the above situation exists... the situation being that a 'VIRUS1' was found on 'MYCOMPUTER1' and that it was Blocked and Cleanable... a later event showed that the 'VIRUS1' on 'MYCOMPUTER1' was Cleaned up and the event has been Resolved.  By doing this, I can then have a list of viruses that the AV was not able to automatically cleanup and will need to be addressed by a support technician.&lt;/P&gt;

&lt;P&gt;Help and tips will be greatly appreciated - Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2012 20:36:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47881#M11426</guid>
      <dc:creator>ARothman</dc:creator>
      <dc:date>2012-08-30T20:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47882#M11427</link>
      <description>&lt;P&gt;So if you tag what's OK, then look for the latest OK-ness based on what makes the event unique ( I'm assuming ComputerName EventName and EventType ) then you can eliminate what's no longer an issue.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval status=if((Action=="Blocked" AND Status=="Cleanable") OR (Action=="Cleaned up" AND Status=="Resolved"),"ok","issue") | stats latest(status) as current_status latest(EventTime) as LastEvent by ComputerName EventName EventType | where current_status=="issue"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Aug 2012 22:03:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47882#M11427</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2012-08-30T22:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47883#M11428</link>
      <description>&lt;P&gt;When I saw this I kind of felt silly for not figuring it out on my own &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;This almost works - problem I run into is that 'latest()' is currently bugged and only works if 'earliest()' is also included... which of course completely defeats the purpose.&lt;/P&gt;

&lt;P&gt;I also changed it around a little bit and this -would- work, if latest wasn't bugged. Time for some more trial &amp;amp; error:&lt;/P&gt;

&lt;P&gt;eval status=if(Status=="Not cleanable" OR Status=="Cleanup failed" OR Status=="Restart required","issue","ok") | stats latest(status) as current_status by Region ComputerName EventName Status | where current_status=="issue"&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:21:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47883#M11428</guid>
      <dc:creator>ARothman</dc:creator>
      <dc:date>2020-09-28T12:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47884#M11429</link>
      <description>&lt;P&gt;you could do&lt;BR /&gt;&lt;BR /&gt;
values(EventTime) as LastEvent | eval LastEvent=mvindex(LastEvent,-1)&lt;/P&gt;

&lt;P&gt;Not tested, but theoretically if should pop off the last non-null EventTime returned by the search..  &lt;/P&gt;

&lt;P&gt;Actually you might need mvindex(LastEvent,0)  -  depends if the results are in chronological order or not  &lt;/P&gt;

&lt;P&gt;Out of interest - where did you get the info about latest() being bugged ?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2012 15:05:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47884#M11429</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2012-08-31T15:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47885#M11430</link>
      <description>&lt;P&gt;Thanks jonuwz, I'll do some playing around with that.&lt;/P&gt;

&lt;P&gt;I found this article when I noticed that 'latest()' wasn't returning any results:&lt;BR /&gt;
&lt;A href="http://splunk-base.splunk.com/answers/42084/latest-function-in-stats-not-working-without-earliest"&gt;http://splunk-base.splunk.com/answers/42084/latest-function-in-stats-not-working-without-earliest&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;One other thing I noticed, which was causing me some grief, was that I was including 'Status' in the stats, so this was also causing me to see results which were unwanted.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2012 15:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47885#M11430</guid>
      <dc:creator>ARothman</dc:creator>
      <dc:date>2012-08-31T15:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47886#M11431</link>
      <description>&lt;P&gt;Thanks for the link. It's fixed in 4.3.3, so that explains why I haven't seen the problem.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2012 16:10:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47886#M11431</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2012-08-31T16:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47887#M11432</link>
      <description>&lt;P&gt;Looks like I'll be needing to update my 4.3 to 4.3.3 then - thanks again for the help&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2012 16:40:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47887#M11432</guid>
      <dc:creator>ARothman</dc:creator>
      <dc:date>2012-08-31T16:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results and remove results based on conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47888#M11433</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Could you please share what did you use instead of "Status" in latest command, to get the correct output for the above query. &lt;/P&gt;

&lt;P&gt;"One other thing I noticed, which was causing me some grief, was that I was including 'Status' in the stats, so this was also causing me to see results which were unwanted."&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
SG.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 04:30:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-and-remove-results-based-on-conditions/m-p/47888#M11433</guid>
      <dc:creator>sanjayg</dc:creator>
      <dc:date>2016-10-25T04:30:25Z</dc:date>
    </item>
  </channel>
</rss>

