<?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: Handling empty fields in format command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223485#M65795</link>
    <description>&lt;P&gt;Just replace "| where" by "| search" and it should work fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt; | search NOT [&amp;lt;sub-query&amp;gt; | fields &amp;lt;field&amp;gt; | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See this run anywhere sample search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal  earliest=-15m  | head 100 | search NOT [ search index=_internal32454  earliest=-15m | head 1| table sourcetype | makemv sourcetype | mvexpand sourcetype | format ]| stats count by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Replace search by where to check that your error is replicated&lt;/P&gt;</description>
    <pubDate>Mon, 14 Sep 2015 18:22:31 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-09-14T18:22:31Z</dc:date>
    <item>
      <title>Handling empty fields in format command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223484#M65794</link>
      <description>&lt;P&gt;I have a search that uses a subsearch to filter out certain kinds of logs. I'm using the &lt;CODE&gt;format&lt;/CODE&gt; command to create the filter list for the base search, as so: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt; | where NOT [&amp;lt;subsearch&amp;gt; | fields &amp;lt;field&amp;gt; | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Everything works fine until there's a time period where there's nothing that needs filtering. Instead, &lt;CODE&gt;format&lt;/CODE&gt; simply returns &lt;CODE&gt;NOT ()&lt;/CODE&gt; which causes the base search to fail with this message:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'where' command: The 'not' function is unsupported or undefined.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a standard way to handle this situation? I've tried using &lt;CODE&gt;fillnull&lt;/CODE&gt; with no success.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 14:57:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223484#M65794</guid>
      <dc:creator>ceedwlt</dc:creator>
      <dc:date>2015-09-14T14:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Handling empty fields in format command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223485#M65795</link>
      <description>&lt;P&gt;Just replace "| where" by "| search" and it should work fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt; | search NOT [&amp;lt;sub-query&amp;gt; | fields &amp;lt;field&amp;gt; | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See this run anywhere sample search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal  earliest=-15m  | head 100 | search NOT [ search index=_internal32454  earliest=-15m | head 1| table sourcetype | makemv sourcetype | mvexpand sourcetype | format ]| stats count by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Replace search by where to check that your error is replicated&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 18:22:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223485#M65795</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-14T18:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Handling empty fields in format command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223486#M65796</link>
      <description>&lt;P&gt;Get rid of the &lt;CODE&gt;| where&lt;/CODE&gt; and it should work fine.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:59:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223486#M65796</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-14T19:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Handling empty fields in format command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223487#M65797</link>
      <description>&lt;P&gt;Perfect, that solved it - thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 09:09:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223487#M65797</guid>
      <dc:creator>ceedwlt</dc:creator>
      <dc:date>2015-09-15T09:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Handling empty fields in format command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223488#M65798</link>
      <description>&lt;P&gt;As my solution indicates, you should not need either clause.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 14:27:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223488#M65798</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-15T14:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Handling empty fields in format command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223489#M65799</link>
      <description>&lt;P&gt;This also works, I didn't have time to check it earlier. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 14:50:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-empty-fields-in-format-command/m-p/223489#M65799</guid>
      <dc:creator>ceedwlt</dc:creator>
      <dc:date>2015-09-15T14:50:46Z</dc:date>
    </item>
  </channel>
</rss>

