<?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: Replaceing NULL string for null() in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219429#M64486</link>
    <description>&lt;P&gt;Could you set a calculated field in props.conf for the field(s) in question, maybe something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-field1 = if(field1="NULL",null(),field1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in the search you could use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | where if(isnull(field1),1,0)=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My instance of Splunk complains about datatype mismatch when I try ... | where field1=null(), but that may just be down to my sample data.&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
    <pubDate>Tue, 09 Aug 2016 11:16:29 GMT</pubDate>
    <dc:creator>davebrooking</dc:creator>
    <dc:date>2016-08-09T11:16:29Z</dc:date>
    <item>
      <title>Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219426#M64483</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm trying to reuse an old app for a new environment and, of course, data and fields similar but different, so adapting this part is where the big efforts come. It's 90% done already but, however, I'm stucked in this point. I've got semicolon-separated data, that makes it really simple to parse. The problem is that, fields with no data contain the string &lt;CODE&gt;"NULL"&lt;/CODE&gt;. This doesn't fit at all my needs. What I need is to convert these &lt;CODE&gt;NULL&lt;/CODE&gt; strings into null-valued fields, just the same if I do:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;...| eval myNullField = null()&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I now that I cannot get it using null() into a SEDCMD, but just to explain this better, this shouold be perfect:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;SEDCMD-NullStringtoNull = s/NULL/null()/g&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I don't know if null() returns and hex code that means null for Splunk... Using that code into a SEDCMD could do the trick.&lt;/P&gt;

&lt;P&gt;Of course, an easy option could be rewriting that fields with SPL, but that implies modifying each query, and that is my very last option.&lt;/P&gt;

&lt;P&gt;Thanks a lot!! &lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 06:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219426#M64483</guid>
      <dc:creator>jdanij</dc:creator>
      <dc:date>2016-08-09T06:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219427#M64484</link>
      <description>&lt;P&gt;&lt;STRONG&gt;NOT TESTED&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Have you tried this instead?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-NullStringtoNull = s/NULL//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Aug 2016 08:14:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219427#M64484</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-08-09T08:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219428#M64485</link>
      <description>&lt;P&gt;Yes, that was my first option, but I get no results when I look for that fields like this:&lt;BR /&gt;
&lt;CODE&gt;... | where nullfield=null()&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;That makes me think that empty-string is not the same as null()...&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 09:49:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219428#M64485</guid>
      <dc:creator>jdanij</dc:creator>
      <dc:date>2016-08-09T09:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219429#M64486</link>
      <description>&lt;P&gt;Could you set a calculated field in props.conf for the field(s) in question, maybe something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-field1 = if(field1="NULL",null(),field1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in the search you could use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | where if(isnull(field1),1,0)=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My instance of Splunk complains about datatype mismatch when I try ... | where field1=null(), but that may just be down to my sample data.&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 11:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219429#M64486</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2016-08-09T11:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219430#M64487</link>
      <description>&lt;P&gt;what about?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where isNull(nullfield)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Aug 2016 12:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219430#M64487</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-08-09T12:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219431#M64488</link>
      <description>&lt;P&gt;yes, this is working!! &lt;BR /&gt;
But I'm in doubt... what's the difference between &lt;CODE&gt;... | where field1 = null()&lt;/CODE&gt; and &lt;CODE&gt;... | where isnull(field1)&lt;/CODE&gt;??&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 12:43:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219431#M64488</guid>
      <dc:creator>jdanij</dc:creator>
      <dc:date>2016-08-09T12:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219432#M64489</link>
      <description>&lt;P&gt;null() is a function that returns a NULL value and you can use that as part of eval to assign a NULL value to your field.&lt;/P&gt;

&lt;P&gt;Where is expecting a boolean result (true, false) and should throw the following error when you do | where field = null():&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'where' command: Typechecking failed. The '==' operator received different types. 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Aug 2016 14:23:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219432#M64489</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-08-09T14:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219433#M64490</link>
      <description>&lt;P&gt;By the way, if you are happy with the answer please don't forget to mark it as answered so that others can benefit from it in future&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 14:34:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219433#M64490</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-08-09T14:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219434#M64491</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; SEDCMD-NullStringtoNull = s/NULL//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then test like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | where isnull(nullfield)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Aug 2016 15:57:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219434#M64491</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-08-09T15:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219435#M64492</link>
      <description>&lt;P&gt;Hi @jdanij, out of curiosity, what's the difference between this answer and mine apart from the fact I answered it hours before and provided a lot more detail, answered all your questions, and spent a decent amount of time there. &lt;/P&gt;

&lt;P&gt;Just curious to know why you didn't mark mine instead. &lt;/P&gt;

&lt;P&gt;Also curious to know why @woodcock posted this without having read mine first as it had already been answered in exactly the same way. &lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 07:32:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219435#M64492</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-09-01T07:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219436#M64493</link>
      <description>&lt;P&gt;I open a ton of tabs early in the morning and in my down-time I answer and then close.  I guess I should refresh first.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 16:48:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219436#M64493</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-09-01T16:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replaceing NULL string for null()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219437#M64494</link>
      <description>&lt;P&gt;Also, MANY times questions get flagged for moderation and when that happens, all answers are pended (not published) until the moderation is cleared and then all the answers come out at the same time.   This is another reason for every similar answers and has happened to me many times.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 17:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replaceing-NULL-string-for-null/m-p/219437#M64494</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-09-01T17:20:11Z</dc:date>
    </item>
  </channel>
</rss>

