<?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: Fields through REST API in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Fields-through-REST-API/m-p/24293#M4428</link>
    <description>&lt;P&gt;Splunk will not extract or persist fields by default if the search parser tells it that the given fields are not referenced in the search language anywhere. &lt;/P&gt;

&lt;P&gt;You can of course trigger the extraction by tacking on a fields command as you've discovered: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | fields someDesiredField anotherDesiredField 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As far as a more general solution, you can tack on &lt;CODE&gt;fields *&lt;/CODE&gt; to tell it to extract every field. &lt;/P&gt;

&lt;P&gt;And at the API level,  you can also send required_field_list=*  on the POST when you dispatch the job. &lt;/P&gt;

&lt;P&gt;Be aware that when you search with &lt;CODE&gt;fields *&lt;/CODE&gt; or submit with the API arg &lt;CODE&gt;required_field_list&lt;/CODE&gt; set to *,  your searches will incur a what can be a significant performance drain, as every possible extraction will be run. &lt;/P&gt;

&lt;P&gt;(as to why the default search UI always has every field,  the presence of the FieldPicker module in the view XML triggers a change to where all searches get dispatched with the REST arg &lt;CODE&gt;required_field_list=*&lt;/CODE&gt;.  To come full circle, when you turn off 'automatic field discovery' in the UI,  what's happening is it then falls back to submitting &lt;CODE&gt;required_field_list=&amp;lt;just the selected fields please&amp;gt;&lt;/CODE&gt;)&lt;/P&gt;

&lt;P&gt;In general if you're using the REST API you really should become as familiar with status_buckets and required_field_list sooner rather than later because behavior can be quite counterintuitive. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/4.2.1/Developer/RESTSearch" target="_blank"&gt;http://www.splunk.com/base/Documentation/4.2.1/Developer/RESTSearch&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 09:39:25 GMT</pubDate>
    <dc:creator>sideview</dc:creator>
    <dc:date>2020-09-28T09:39:25Z</dc:date>
    <item>
      <title>Fields through REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fields-through-REST-API/m-p/24292#M4427</link>
      <description>&lt;P&gt;When using the REST API through a Java application I only receive fields that I explicitly search for (e.g. "5109483394 | fields Number, Location, LogType").  I have set up these fields in transforms.conf and this works using the Search app without having to specifically search for the fields (e.g "5109483394").  Is there anyway to set this fields to show up without directly searching for them?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2011 18:44:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fields-through-REST-API/m-p/24292#M4427</guid>
      <dc:creator>klbiggs</dc:creator>
      <dc:date>2011-06-07T18:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Fields through REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fields-through-REST-API/m-p/24293#M4428</link>
      <description>&lt;P&gt;Splunk will not extract or persist fields by default if the search parser tells it that the given fields are not referenced in the search language anywhere. &lt;/P&gt;

&lt;P&gt;You can of course trigger the extraction by tacking on a fields command as you've discovered: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | fields someDesiredField anotherDesiredField 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As far as a more general solution, you can tack on &lt;CODE&gt;fields *&lt;/CODE&gt; to tell it to extract every field. &lt;/P&gt;

&lt;P&gt;And at the API level,  you can also send required_field_list=*  on the POST when you dispatch the job. &lt;/P&gt;

&lt;P&gt;Be aware that when you search with &lt;CODE&gt;fields *&lt;/CODE&gt; or submit with the API arg &lt;CODE&gt;required_field_list&lt;/CODE&gt; set to *,  your searches will incur a what can be a significant performance drain, as every possible extraction will be run. &lt;/P&gt;

&lt;P&gt;(as to why the default search UI always has every field,  the presence of the FieldPicker module in the view XML triggers a change to where all searches get dispatched with the REST arg &lt;CODE&gt;required_field_list=*&lt;/CODE&gt;.  To come full circle, when you turn off 'automatic field discovery' in the UI,  what's happening is it then falls back to submitting &lt;CODE&gt;required_field_list=&amp;lt;just the selected fields please&amp;gt;&lt;/CODE&gt;)&lt;/P&gt;

&lt;P&gt;In general if you're using the REST API you really should become as familiar with status_buckets and required_field_list sooner rather than later because behavior can be quite counterintuitive. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/4.2.1/Developer/RESTSearch" target="_blank"&gt;http://www.splunk.com/base/Documentation/4.2.1/Developer/RESTSearch&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:39:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fields-through-REST-API/m-p/24293#M4428</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2020-09-28T09:39:25Z</dc:date>
    </item>
  </channel>
</rss>

