<?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: Can you use the predict command with multiple fields without having to type them all? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391214#M113913</link>
    <description>&lt;P&gt;made it work!&lt;BR /&gt;
thanks&lt;/P&gt;</description>
    <pubDate>Wed, 24 Oct 2018 18:24:39 GMT</pubDate>
    <dc:creator>splunkiesplunkh</dc:creator>
    <dc:date>2018-10-24T18:24:39Z</dc:date>
    <item>
      <title>Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391205#M113904</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am looking to use &lt;CODE&gt;predict&lt;/CODE&gt; command with multiple fields without typing all their names.&lt;BR /&gt;
For example I know it can be used liked this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Make results |Predict field1 field2 field3 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But what I need is..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Make results | timechart Amount by Name 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This makes columns like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time A1 A2 A3 A4 ......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't want to type all the field names, I just want to write something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|predict A* 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Sep 2018 20:11:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391205#M113904</guid>
      <dc:creator>splunkiesplunkh</dc:creator>
      <dc:date>2018-09-24T20:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391206#M113905</link>
      <description>&lt;P&gt;Hi splunkiesplunkhead&lt;/P&gt;

&lt;P&gt;I don't really think you can use &lt;CODE&gt;predict&lt;/CODE&gt; like that, it expects explicit declaration of all the fields.&lt;/P&gt;

&lt;P&gt;When you call &lt;CODE&gt;| predict A*&lt;/CODE&gt;&lt;BR /&gt;
You get the error&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;command="predict", Unknown field: A* &lt;BR /&gt;
I'll actually be following this thread in case someone offers a positive solution for this.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sat, 06 Oct 2018 18:13:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391206#M113905</guid>
      <dc:creator>lumnious</dc:creator>
      <dc:date>2018-10-06T18:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391207#M113906</link>
      <description>&lt;P&gt;Here is the trick that you need.  Run your search twice.  Once inside of a &lt;CODE&gt;map&lt;/CODE&gt; + &lt;CODE&gt;subsearch&lt;/CODE&gt; that generates the same results so that you can access the fields and build a string that contains them, which you then pass back out to the same search, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Your Search Here&amp;gt;
| eval _field_list=" "
| foreach * [ eval _field_list = _field_list . " &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" ]
| rename _field_list AS field_list
| table field_list
| map search="search &amp;lt;Your Search Here&amp;gt; | predict [|makeresults | eval field_list=$field_list$ | return $field_list ] "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Take a look at this run-anywhere search where my &lt;CODE&gt;table&lt;/CODE&gt; command has arguments similar to your &lt;CODE&gt;predict&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval A=1, B=2, C=3
| eval _field_list=" "
| foreach * [ eval _field_list = _field_list . " &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"]
| rename _field_list AS field_list
| table field_list
| map search="|makeresults | eval A=1, B=2, C=3 | table [|makeresults | eval field_list=$field_list$ | return $field_list ]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You will be tempted to think that you can get away without the &lt;CODE&gt;subsearch&lt;/CODE&gt; (ending with &lt;CODE&gt;| table $field_list$&lt;/CODE&gt;) but you cannot because the &lt;CODE&gt;map&lt;/CODE&gt; command inserts double-quotes around arguments (so you end up with &lt;CODE&gt;| table "A B C"&lt;/CODE&gt; instead of &lt;CODE&gt;| table A B C&lt;/CODE&gt;) and so we embed a &lt;CODE&gt;subsearch&lt;/CODE&gt; to strip them off.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Oct 2018 20:20:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391207#M113906</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-10-07T20:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391208#M113907</link>
      <description>&lt;P&gt;hi @splunkiessplunkhead (woah, what a name!)&lt;/P&gt;

&lt;P&gt;Did one of the answer's below solve your problem? If so, please resolve this post by approving it!  If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 19:13:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391208#M113907</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-10-12T19:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391209#M113908</link>
      <description>&lt;P&gt;Hi, I am trying to implement this but getting errors, may be doing something wrong. Will try and fix it. If it does work I will accept the answer.&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2018 18:32:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391209#M113908</guid>
      <dc:creator>splunkiesplunkh</dc:creator>
      <dc:date>2018-10-19T18:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391210#M113909</link>
      <description>&lt;P&gt;Hi @woodcook &lt;BR /&gt;
The method works without the map search.&lt;BR /&gt;
I just populate the list of the fields in a separate search and add that in front of predict command like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;my search&amp;gt;
|timechart Amount by Category limit=0 ("this generates field names that I need)
|predict [another search here to make the same field list as above| return $field_list]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works fine if my number of fields are as high as 27.&lt;BR /&gt;
 The next setting I tried had 214 fields and it doesnt return anything. Neither does it throw any error... Is there an upper limit for number of fields?&lt;BR /&gt;
Also can I suppress upper95 and lower95 such that they arent generated at all, just one prediction field is generated per field&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 22:32:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391210#M113909</guid>
      <dc:creator>sarauppal</dc:creator>
      <dc:date>2018-10-23T22:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391211#M113910</link>
      <description>&lt;P&gt;Hi @woodcook &lt;BR /&gt;
The method works without the map search.&lt;BR /&gt;
I just populate the list of the fields in a separate search and add that in front of predict command like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;my search&amp;gt;
|timechart Amount by Category limit=0 ("this generates field names that I need)
|predict [another search here to make the same field list as above| return $field_list]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works fine if my number of fields are as high as 27.&lt;BR /&gt;
 The next setting I tried had 214 fields and it doesnt return anything. Neither does it throw any error... Is there an upper limit for number of fields?&lt;BR /&gt;
Also can I suppress upper95 and lower95 such that they arent generated at all, just one prediction field is generated per field&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 22:33:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391211#M113910</guid>
      <dc:creator>sarauppal</dc:creator>
      <dc:date>2018-10-23T22:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391212#M113911</link>
      <description>&lt;P&gt;To be fair, that is a different question and you should &lt;CODE&gt;Accept&lt;/CODE&gt; this answer and ask a new one.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 22:52:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391212#M113911</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-10-23T22:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391213#M113912</link>
      <description>&lt;P&gt;Thanks @woodcock.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 18:23:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391213#M113912</guid>
      <dc:creator>splunkiesplunkh</dc:creator>
      <dc:date>2018-10-24T18:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391214#M113913</link>
      <description>&lt;P&gt;made it work!&lt;BR /&gt;
thanks&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 18:24:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/391214#M113913</guid>
      <dc:creator>splunkiesplunkh</dc:creator>
      <dc:date>2018-10-24T18:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can you use the predict command with multiple fields without having to type them all?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/516374#M145096</link>
      <description>&lt;P&gt;Can you explain this a bit better?&lt;BR /&gt;&lt;BR /&gt;I'm trying to run that query you have, but its just not working?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 20:05:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-use-the-predict-command-with-multiple-fields-without/m-p/516374#M145096</guid>
      <dc:creator>morawi5</dc:creator>
      <dc:date>2020-08-26T20:05:20Z</dc:date>
    </item>
  </channel>
</rss>

