<?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 search for events that have null values for a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-events-that-have-null-values-for-a-field/m-p/167280#M47630</link>
    <description>&lt;P&gt;The key difference to my question is the fact that &lt;CODE&gt;request&lt;/CODE&gt; points to a nested object.&lt;/P&gt;

&lt;P&gt;For simple fields whose values are literal values (string, boolean, int), any of the following would solve the simple case to find events where a top-level field, &lt;CODE&gt;testField&lt;/CODE&gt; is null:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;app="my_app" NOT testField="*"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;app="my_app" | where isnull(testField)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;However, as my original post explained, I am trying to test for all events where &lt;CODE&gt;request&lt;/CODE&gt; is not present, where &lt;CODE&gt;request&lt;/CODE&gt; normally pointed to an object, not a literal value.&lt;/P&gt;

&lt;P&gt;If I query either:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;app="my_app" NOT request="*"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;app="my_app" | where isnull(request)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It returns all events, effectively treating an object value in &lt;CODE&gt;request&lt;/CODE&gt; as equivalent to NULL.  HOWEVER, if I query specifically on a field I know to always be non-null inside the &lt;CODE&gt;request&lt;/CODE&gt; object, e.g. &lt;CODE&gt;request.method&lt;/CODE&gt;, I can get what I wanted:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;app="my_app" NOT request.method="*"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;app="my_app" | where isnull('request.method')&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;NOTE THE SINGLE QUOTES in the &lt;CODE&gt;isnull&lt;/CODE&gt; call.  Inside where/eval statements, splunk does not handle complex field names, well, and requires you wrap them in SINGLE quotes.  &lt;/P&gt;

&lt;P&gt;Hopefully this answer makes sense and is helpful.  &lt;/P&gt;</description>
    <pubDate>Mon, 20 Oct 2014 22:31:45 GMT</pubDate>
    <dc:creator>abelnation</dc:creator>
    <dc:date>2014-10-20T22:31:45Z</dc:date>
    <item>
      <title>How to search for events that have null values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-events-that-have-null-values-for-a-field/m-p/167279#M47629</link>
      <description>&lt;P&gt;I have json log lines that sometimes contain a &lt;CODE&gt;request&lt;/CODE&gt; object of the form&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;{&lt;BR /&gt;
    timestamp: ts_val,&lt;BR /&gt;
    app: "my_app",&lt;BR /&gt;
    request: {&lt;BR /&gt;
        method: "GET",&lt;BR /&gt;
        status: 200,&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;I am trying to query for events that do not have the &lt;CODE&gt;request&lt;/CODE&gt; value using &lt;CODE&gt;isnull&lt;/CODE&gt;/&lt;CODE&gt;isnotnull&lt;/CODE&gt;, but it doesn't have the expected effect;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;app="my_app" | where isnull(request)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Still returns the full set of events. Can someone clarify what splunk actually treats as NULL? I've seen some weird behavior with nested fields. Are there links to documentation of those conditions?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;I have also tried:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;app="my_app" request=*&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 19:32:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-events-that-have-null-values-for-a-field/m-p/167279#M47629</guid>
      <dc:creator>abelnation</dc:creator>
      <dc:date>2020-06-08T19:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for events that have null values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-events-that-have-null-values-for-a-field/m-p/167280#M47630</link>
      <description>&lt;P&gt;The key difference to my question is the fact that &lt;CODE&gt;request&lt;/CODE&gt; points to a nested object.&lt;/P&gt;

&lt;P&gt;For simple fields whose values are literal values (string, boolean, int), any of the following would solve the simple case to find events where a top-level field, &lt;CODE&gt;testField&lt;/CODE&gt; is null:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;app="my_app" NOT testField="*"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;app="my_app" | where isnull(testField)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;However, as my original post explained, I am trying to test for all events where &lt;CODE&gt;request&lt;/CODE&gt; is not present, where &lt;CODE&gt;request&lt;/CODE&gt; normally pointed to an object, not a literal value.&lt;/P&gt;

&lt;P&gt;If I query either:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;app="my_app" NOT request="*"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;app="my_app" | where isnull(request)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It returns all events, effectively treating an object value in &lt;CODE&gt;request&lt;/CODE&gt; as equivalent to NULL.  HOWEVER, if I query specifically on a field I know to always be non-null inside the &lt;CODE&gt;request&lt;/CODE&gt; object, e.g. &lt;CODE&gt;request.method&lt;/CODE&gt;, I can get what I wanted:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;app="my_app" NOT request.method="*"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;app="my_app" | where isnull('request.method')&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;NOTE THE SINGLE QUOTES in the &lt;CODE&gt;isnull&lt;/CODE&gt; call.  Inside where/eval statements, splunk does not handle complex field names, well, and requires you wrap them in SINGLE quotes.  &lt;/P&gt;

&lt;P&gt;Hopefully this answer makes sense and is helpful.  &lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 22:31:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-events-that-have-null-values-for-a-field/m-p/167280#M47630</guid>
      <dc:creator>abelnation</dc:creator>
      <dc:date>2014-10-20T22:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for events that have null values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-events-that-have-null-values-for-a-field/m-p/167281#M47631</link>
      <description>&lt;P&gt;Damn, those single quotes got me...&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 13:06:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-events-that-have-null-values-for-a-field/m-p/167281#M47631</guid>
      <dc:creator>opsbbgl</dc:creator>
      <dc:date>2020-05-29T13:06:10Z</dc:date>
    </item>
  </channel>
</rss>

