<?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 How to filter by if a field exist? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-by-if-a-field-exist/m-p/624089#M216963</link>
    <description>&lt;P&gt;My sample events look like this , API logs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
   location:  Southeast Asia,  
   properties:  {  
	backendMethod:  GET  
	errors:  [ 
	    {some huge nested object},
	    {some huge nested object}
       ]
   }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to search only the events with the "errors" field. If the API is successful, it does not have this "errors" field, and I don't want to search them.&lt;BR /&gt;&lt;BR /&gt;I have tried&lt;BR /&gt;{baseSearch}&amp;nbsp; | where mvcount('properties.errors') &amp;gt; 0 , this return nothing&lt;BR /&gt;{baseSearch}&amp;nbsp; | where mvcount("properties.errors") &amp;gt; 0 , returning even the events without the "errors" field&lt;BR /&gt;{baseSearch}&amp;nbsp; | where isnotnull('properties.errors'), this return nothing&lt;BR /&gt;{baseSearch}&amp;nbsp; | where isnotnull("properties.errors"),returning even the events without the "errors" field&lt;BR /&gt;{baseSearch}&amp;nbsp; |&amp;nbsp; "properties.errors"=*.&amp;nbsp; ,&amp;nbsp; this return nothing&lt;BR /&gt;&lt;BR /&gt;I just need something simple like&amp;nbsp;{baseSearch}&amp;nbsp; |&amp;nbsp; where exist(properties.errors), what is the most simple way&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Dec 2022 15:12:26 GMT</pubDate>
    <dc:creator>YatMan</dc:creator>
    <dc:date>2022-12-13T15:12:26Z</dc:date>
    <item>
      <title>How to filter by if a field exist?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-by-if-a-field-exist/m-p/624089#M216963</link>
      <description>&lt;P&gt;My sample events look like this , API logs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
   location:  Southeast Asia,  
   properties:  {  
	backendMethod:  GET  
	errors:  [ 
	    {some huge nested object},
	    {some huge nested object}
       ]
   }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to search only the events with the "errors" field. If the API is successful, it does not have this "errors" field, and I don't want to search them.&lt;BR /&gt;&lt;BR /&gt;I have tried&lt;BR /&gt;{baseSearch}&amp;nbsp; | where mvcount('properties.errors') &amp;gt; 0 , this return nothing&lt;BR /&gt;{baseSearch}&amp;nbsp; | where mvcount("properties.errors") &amp;gt; 0 , returning even the events without the "errors" field&lt;BR /&gt;{baseSearch}&amp;nbsp; | where isnotnull('properties.errors'), this return nothing&lt;BR /&gt;{baseSearch}&amp;nbsp; | where isnotnull("properties.errors"),returning even the events without the "errors" field&lt;BR /&gt;{baseSearch}&amp;nbsp; |&amp;nbsp; "properties.errors"=*.&amp;nbsp; ,&amp;nbsp; this return nothing&lt;BR /&gt;&lt;BR /&gt;I just need something simple like&amp;nbsp;{baseSearch}&amp;nbsp; |&amp;nbsp; where exist(properties.errors), what is the most simple way&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 15:12:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-by-if-a-field-exist/m-p/624089#M216963</guid>
      <dc:creator>YatMan</dc:creator>
      <dc:date>2022-12-13T15:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter by if a field exist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-by-if-a-field-exist/m-p/624111#M216969</link>
      <description>&lt;P&gt;Several possibilities. &amp;nbsp;One is to find a common subnode in those huge nested objects. &amp;nbsp;For example, if 'id' is common in the array, do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where isnotnull('properties.errors{}.id')&lt;/LI-CODE&gt;&lt;P&gt;Another could be to run a second spath on the error (which can be beneficial for further processing, anyway)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=properties.errors{}
| where isnotnull('properties.errors{}')&lt;/LI-CODE&gt;&lt;P&gt;(As always, remember to add {} to represent a JSON array.) &amp;nbsp;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 10:20:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-by-if-a-field-exist/m-p/624111#M216969</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-13T10:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter by if a field exist?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-by-if-a-field-exist/m-p/624177#M217002</link>
      <description>&lt;P&gt;This is working, thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 23:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-by-if-a-field-exist/m-p/624177#M217002</guid>
      <dc:creator>YatMan</dc:creator>
      <dc:date>2022-12-13T23:32:33Z</dc:date>
    </item>
  </channel>
</rss>

