<?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 search partial field names and exclude events that contain no value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-partial-field-names-and-exclude-events-that/m-p/442688#M125646</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;
I want my search to only return events that have field names matching &lt;STRONG&gt;&lt;EM&gt;Feature.Flags&lt;/EM&gt;&lt;/STRONG&gt;*&lt;BR /&gt;
My data currently has the below field names but more and more feature flags will be released over time so I don't want to hard code them into the search.&lt;/P&gt;

&lt;P&gt;Feature.Flags.1&lt;BR /&gt;
Feature.Flags.2&lt;BR /&gt;
Feature.Flags.3&lt;/P&gt;

&lt;P&gt;How can I construct a search to only return events that contain any of these Feature.Flags* Field names but to exclude any events when all matching Feature.Flags fields have no value?&lt;/P&gt;

&lt;P&gt;e.g. Only return Event 1 and 3 below&lt;BR /&gt;
&lt;STRONG&gt;Event 1&lt;/STRONG&gt;&lt;BR /&gt;
Feature.Flags.1 = True&lt;BR /&gt;
Feature.Flags.2 = ""&lt;BR /&gt;
Feature.Flags.3 = False&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Event 2&lt;/STRONG&gt; (All Fields have no value so exclude this from the search)&lt;BR /&gt;
Feature.Flags.1 = ""&lt;BR /&gt;
Feature.Flags.2 = ""&lt;BR /&gt;
Feature.Flags.3 = ""&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Event 3&lt;/STRONG&gt;&lt;BR /&gt;
Feature.Flags.1 = False&lt;BR /&gt;
Feature.Flags.2 = False&lt;BR /&gt;
Feature.Flags.3 = False&lt;/P&gt;

&lt;P&gt;I've tried different things but can't get it to work.  For example the below returns all events in a table but unfortunately it includes Events where all Feature.Flags* fields have empty values&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;table host Feature.Flags*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also tried the below but it just returned all entries with HostFlags set to False and none set to True&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval HostFlags="" | foreach "Feature.Flags"* [eval HostFlags='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'] | search HostFlags=*
| table host Feature.Flags*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 Jun 2019 14:52:42 GMT</pubDate>
    <dc:creator>ganon640</dc:creator>
    <dc:date>2019-06-26T14:52:42Z</dc:date>
    <item>
      <title>How to search partial field names and exclude events that contain no value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-partial-field-names-and-exclude-events-that/m-p/442688#M125646</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I want my search to only return events that have field names matching &lt;STRONG&gt;&lt;EM&gt;Feature.Flags&lt;/EM&gt;&lt;/STRONG&gt;*&lt;BR /&gt;
My data currently has the below field names but more and more feature flags will be released over time so I don't want to hard code them into the search.&lt;/P&gt;

&lt;P&gt;Feature.Flags.1&lt;BR /&gt;
Feature.Flags.2&lt;BR /&gt;
Feature.Flags.3&lt;/P&gt;

&lt;P&gt;How can I construct a search to only return events that contain any of these Feature.Flags* Field names but to exclude any events when all matching Feature.Flags fields have no value?&lt;/P&gt;

&lt;P&gt;e.g. Only return Event 1 and 3 below&lt;BR /&gt;
&lt;STRONG&gt;Event 1&lt;/STRONG&gt;&lt;BR /&gt;
Feature.Flags.1 = True&lt;BR /&gt;
Feature.Flags.2 = ""&lt;BR /&gt;
Feature.Flags.3 = False&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Event 2&lt;/STRONG&gt; (All Fields have no value so exclude this from the search)&lt;BR /&gt;
Feature.Flags.1 = ""&lt;BR /&gt;
Feature.Flags.2 = ""&lt;BR /&gt;
Feature.Flags.3 = ""&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Event 3&lt;/STRONG&gt;&lt;BR /&gt;
Feature.Flags.1 = False&lt;BR /&gt;
Feature.Flags.2 = False&lt;BR /&gt;
Feature.Flags.3 = False&lt;/P&gt;

&lt;P&gt;I've tried different things but can't get it to work.  For example the below returns all events in a table but unfortunately it includes Events where all Feature.Flags* fields have empty values&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;table host Feature.Flags*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also tried the below but it just returned all entries with HostFlags set to False and none set to True&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval HostFlags="" | foreach "Feature.Flags"* [eval HostFlags='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'] | search HostFlags=*
| table host Feature.Flags*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jun 2019 14:52:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-partial-field-names-and-exclude-events-that/m-p/442688#M125646</guid>
      <dc:creator>ganon640</dc:creator>
      <dc:date>2019-06-26T14:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to search partial field names and exclude events that contain no value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-partial-field-names-and-exclude-events-that/m-p/442689#M125647</link>
      <description>&lt;P&gt;ganon640&lt;/P&gt;

&lt;P&gt;Try this - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval  Feature.Flags.1 = "True", Feature.Flags.2 = "abc", Feature.Flags.3 = "xyz" | eval HostFlags="" | foreach "Feature.Flags"* [eval HostFlags='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'] | where HostFlags!="" | table Feature.Flags*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval  Feature.Flags.1 = "True", Feature.Flags.2 = "abc", Feature.Flags.3 = "" | eval HostFlags="" | foreach "Feature.Flags"* [eval HostFlags='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'] | where HostFlags!="" | table Feature.Flags*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first one will give you result and the second one will not. Which is what your criteria is.&lt;BR /&gt;
Let me know. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 19:42:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-partial-field-names-and-exclude-events-that/m-p/442689#M125647</guid>
      <dc:creator>amitm05</dc:creator>
      <dc:date>2019-06-26T19:42:47Z</dc:date>
    </item>
  </channel>
</rss>

