<?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: How to grep filter search results with does not equal in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180393#M51958</link>
    <description>&lt;P&gt;Thanks this was helpful!&lt;/P&gt;</description>
    <pubDate>Fri, 21 Mar 2014 14:23:27 GMT</pubDate>
    <dc:creator>tbalouch</dc:creator>
    <dc:date>2014-03-21T14:23:27Z</dc:date>
    <item>
      <title>How to grep filter search results with does not equal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180391#M51956</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I want to filter a virus scan log on my nix systems but having and issue creating the alert for the search. I only want it to send the alert if the search does not match 0, which means there was a virus detected. This is what I have so far:&lt;/P&gt;

&lt;P&gt;source="/var/log/uvscan.log" | search Possibly Infected:.............     0&lt;/P&gt;

&lt;P&gt;How can I change this search to be only show results that don't match search Possibly Infected:.............     0? &lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2014 22:15:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180391#M51956</guid>
      <dc:creator>tbalouch</dc:creator>
      <dc:date>2014-03-10T22:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to grep filter search results with does not equal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180392#M51957</link>
      <description>&lt;P&gt;It sounds to me like you should take the search tutorial, especially parts 4 and 5 which cover searching. &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/WelcometotheSearchTutorial"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/WelcometotheSearchTutorial&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The direct answer to your question is: put a NOT before your search statement. But I see more issues with your search.&lt;/P&gt;

&lt;P&gt;First of all, you're telling Splunk to first grab ALL events from the data with source "/var/log/uvscan.log" and THEN start filtering. This is inefficient - while it may work OK with small files, it'll become a performance nightmare with large ones, as Splunk needs to read all those events off disk even though you're only interested in a fraction of them. You should put as much filtering as possible in your base search instead.&lt;/P&gt;

&lt;P&gt;Also while you certainly can search for events which do not have the specific string "Possibly Infected:............ 0" a better approach would be to create a field extraction instead, so you can do something like "NOT Possibly_Infected=0".&lt;/P&gt;

&lt;P&gt;All in all, the rewritten search with these suggested changes would look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/var/log/uvscan.log" NOT Possibly_Infected=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or, if you still don't want to extract the field for some reason, just&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/var/log/uvscan.log" NOT "Possibly Infected:............. 0"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Mar 2014 22:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180392#M51957</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2014-03-10T22:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to grep filter search results with does not equal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180393#M51958</link>
      <description>&lt;P&gt;Thanks this was helpful!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 14:23:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180393#M51958</guid>
      <dc:creator>tbalouch</dc:creator>
      <dc:date>2014-03-21T14:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to grep filter search results with does not equal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180394#M51959</link>
      <description>&lt;P&gt;I figured this and it worked for me: host OP AND eventtype=cisco_ios | search 3C:00:E6:01:8D:02&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2015 23:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-grep-filter-search-results-with-does-not-equal/m-p/180394#M51959</guid>
      <dc:creator>bbiandov</dc:creator>
      <dc:date>2015-07-18T23:20:42Z</dc:date>
    </item>
  </channel>
</rss>

