<?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: Why does isnotnull command return true for blank Country field added by iplocation? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477642#M134024</link>
    <description>&lt;P&gt;Blank is not the same as null so &lt;CODE&gt;isnotnull(blank)&lt;/CODE&gt; is correct.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2019 17:46:01 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-09-09T17:46:01Z</dc:date>
    <item>
      <title>Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477637#M134019</link>
      <description>&lt;P&gt;I am using the &lt;CODE&gt;iplocation&lt;/CODE&gt; command on an IP based field to add new fields to each event, most importantly the &lt;STRONG&gt;Country&lt;/STRONG&gt; field. I want to then filter the output to only entries where the &lt;STRONG&gt;Country&lt;/STRONG&gt; field is not blank. I tried using: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Country=* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but entries with blank values still are returned.&lt;/P&gt;

&lt;P&gt;I also tried using: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;isnotnull(Country) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it returns true where the field is clearly blank. Can anyone explain this behavior?&lt;/P&gt;

&lt;P&gt;My query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index::proxy host::proxyhost sourcetype::bcoat_log 
| regex cs_host="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" 
| top cs_host limit=0 
| iplocation cs_host 
| search Country=*
| eval null=if(isnotnull(Country),"true","false")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Sep 2019 19:26:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477637#M134019</guid>
      <dc:creator>frbuser</dc:creator>
      <dc:date>2019-09-05T19:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477638#M134020</link>
      <description>&lt;P&gt;&lt;CODE&gt;Country=*&lt;/CODE&gt; searches for all values of Country, including blank.  To find non-blank values, try &lt;CODE&gt;NOT Country = ""&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 20:31:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477638#M134020</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-05T20:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477639#M134021</link>
      <description>&lt;P&gt;@richgalloway Entries with blank values still show up with that.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 21:04:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477639#M134021</guid>
      <dc:creator>frbuser</dc:creator>
      <dc:date>2019-09-05T21:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477640#M134022</link>
      <description>&lt;P&gt;So it does.  Sorry about that.  Try &lt;CODE&gt;where&lt;/CODE&gt; instead as in this run-anywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults annotate=t 
| eval cs_host="8.8.8.8" 
| iplocation cs_host 
| where isnotnull(Country)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Sep 2019 21:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477640#M134022</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-05T21:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477641#M134023</link>
      <description>&lt;P&gt;@richgalloway &lt;CODE&gt;where&lt;/CODE&gt; also does not work. Per my original question, the problem is that the &lt;CODE&gt;isnotnull()&lt;/CODE&gt; function is returning true for some fields that are &lt;STRONG&gt;blank&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 17:15:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477641#M134023</guid>
      <dc:creator>frbuser</dc:creator>
      <dc:date>2019-09-09T17:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477642#M134024</link>
      <description>&lt;P&gt;Blank is not the same as null so &lt;CODE&gt;isnotnull(blank)&lt;/CODE&gt; is correct.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 17:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477642#M134024</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-09T17:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477643#M134025</link>
      <description>&lt;P&gt;I agree an empty string is not a NULL which is absence of any value. You can do an isnotnull or Len = 0&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 17:53:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477643#M134025</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2019-09-09T17:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477644#M134026</link>
      <description>&lt;P&gt;@richgalloway what is &lt;CODE&gt;isnotnull(blank)&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 17:58:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477644#M134026</guid>
      <dc:creator>frbuser</dc:creator>
      <dc:date>2019-09-09T17:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477645#M134027</link>
      <description>&lt;P&gt;@starcher how do you check that the len of a field is not 0?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:01:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477645#M134027</guid>
      <dc:creator>frbuser</dc:creator>
      <dc:date>2019-09-09T18:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477646#M134028</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/TextFunctions"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/TextFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:03:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477646#M134028</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2019-09-09T18:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477647#M134029</link>
      <description>&lt;P&gt;@starcher &lt;CODE&gt;eval length=len(Country)&lt;/CODE&gt; doesn't return any numeric value for some fields that have no &lt;EM&gt;visible&lt;/EM&gt; value. These appear to be the null values. If I combine &lt;CODE&gt;isnotnull(Country) AND NOT len(Country)=0&lt;/CODE&gt; this appears to work.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477647#M134029</guid>
      <dc:creator>frbuser</dc:creator>
      <dc:date>2019-09-09T18:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why does isnotnull command return true for blank Country field added by iplocation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477648#M134030</link>
      <description>&lt;P&gt;By that I mean a field with blanks for a value is not null.  Therefore, &lt;CODE&gt;isnotnull()&lt;/CODE&gt; will correctly return &lt;CODE&gt;true&lt;/CODE&gt; for that field.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 12:17:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-isnotnull-command-return-true-for-blank-Country-field/m-p/477648#M134030</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-11T12:17:56Z</dc:date>
    </item>
  </channel>
</rss>

