<?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 Why does &amp;quot;search host!=ComputerName&amp;quot; return all results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-search-host-ComputerName-quot-return-all-results/m-p/179619#M51717</link>
    <description>&lt;P&gt;I'm looking for Splunk Universal Forwarders that have a different name registered other than the actual host name.  This usually happens when a server is renamed.  When I execute the search below, I get back the same # of events as if I don't do the comparison.  An export of the data to Excel with a simple comparison formula shows that out of the 2619 events returned there are actually 15 servers with old host names.&lt;/P&gt;

&lt;P&gt;Why doesn't the search return 15 events?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=machine sourcetype=WinHostMon source=os host=* ComputerName=* | search host!=ComputerName | table host ComputerName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 26 Jun 2015 22:36:47 GMT</pubDate>
    <dc:creator>DamageSplunk</dc:creator>
    <dc:date>2015-06-26T22:36:47Z</dc:date>
    <item>
      <title>Why does "search host!=ComputerName" return all results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-search-host-ComputerName-quot-return-all-results/m-p/179619#M51717</link>
      <description>&lt;P&gt;I'm looking for Splunk Universal Forwarders that have a different name registered other than the actual host name.  This usually happens when a server is renamed.  When I execute the search below, I get back the same # of events as if I don't do the comparison.  An export of the data to Excel with a simple comparison formula shows that out of the 2619 events returned there are actually 15 servers with old host names.&lt;/P&gt;

&lt;P&gt;Why doesn't the search return 15 events?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=machine sourcetype=WinHostMon source=os host=* ComputerName=* | search host!=ComputerName | table host ComputerName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jun 2015 22:36:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-search-host-ComputerName-quot-return-all-results/m-p/179619#M51717</guid>
      <dc:creator>DamageSplunk</dc:creator>
      <dc:date>2015-06-26T22:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why does "search host!=ComputerName" return all results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-search-host-ComputerName-quot-return-all-results/m-p/179620#M51718</link>
      <description>&lt;P&gt;Just like how in your base search &lt;CODE&gt;sourcetype=WinHostMon&lt;/CODE&gt; is looking for the sourcetype field to match the string &lt;CODE&gt;WinHostMon&lt;/CODE&gt; and not a field named WinHostMon, so your search is doing the same looking any host that is not the string ComputerName&lt;/P&gt;

&lt;P&gt;What you want instead is the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/where"&gt;where command&lt;/A&gt; which allows for more precision, and &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/CommonEvalFunctions"&gt;even lets you use useful functions&lt;/A&gt; in comparisons!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=machine sourcetype=WinHostMon source=os host= ComputerName= | where host!=ComputerName | table host ComputerName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jun 2015 22:43:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-search-host-ComputerName-quot-return-all-results/m-p/179620#M51718</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-06-26T22:43:08Z</dc:date>
    </item>
  </channel>
</rss>

