<?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: when using predict fields become null in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383303#M111934</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You are applying a table command after a timechart and prediction command. There is actually, no event command from your timechart - your timechart (and the subsequent fields like residual,anomaly etc.) are all based on evals of count. There is no way events are going to be captured AFTER you apply a timechart command and just use the count , based on the timechart for further processing.&lt;BR /&gt;
For example, if i write something like this &lt;CODE&gt;| eval event="vvvv" | table |table event, anomaly, count&lt;/CODE&gt; , then you will receive an event field with vvv as the field values, see what I mean?&lt;BR /&gt;
It is difficult to say what actually you want under the event field , but if I just slightly modify your timechart command to something like this -  &lt;CODE&gt;|timechart span=5m sum(count) as count, values(_raw) as event&lt;/CODE&gt; and then run the rest of your query (including |table event,anomaly,count) you WILL get values under the event field (event =_raw) in this case.&lt;BR /&gt;
My example is bad and the query takes a long time to execute, try running this for last 15 mins. What i did was select the _audit index so that you can use the code as it is, run this code for the lats 15 minutes and see the otuput &lt;CODE&gt;index="_audit" |  timechart span=5m sum(count) as count, values(_raw) as event&lt;BR /&gt;
| predict count as prediction algorithm=LLP5 future_timespan=200 holdback=0&lt;BR /&gt;
| eval residual=count-round(prediction,0)&lt;BR /&gt;
| streamstats window=200 current=true median(residual) as median_of_residual&lt;BR /&gt;
| eval abs_dev=(abs(residual - median_of_residual))&lt;BR /&gt;
| streamstats window=200 current=true median(abs_dev) as median_abs_dev&lt;BR /&gt;
| eval upper_bound=(median_of_residual + median_abs_dev * 20) &lt;BR /&gt;
| eval anomaly=if(residual &amp;gt; upper_bound,1,0)|table event, anomaly, count&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;So, either you need to include what you mean by event in the timechart(your prediction for count will remain unscathed ) OR define something using an eval for the event to pick values&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:00:51 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2020-09-29T20:00:51Z</dc:date>
    <item>
      <title>when using predict fields become null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383300#M111931</link>
      <description>&lt;P&gt;so when I use the predict command my fields become null&lt;/P&gt;

&lt;P&gt;index=summary source="summary_events_2" &lt;BR /&gt;
orig_source=&lt;EM&gt;pnr&lt;/EM&gt;&lt;BR /&gt;
ms_level=ERROR OR ms_level=error&lt;BR /&gt;
NOT event=no-event&lt;BR /&gt;
| timechart span=5m sum(count) as count&lt;BR /&gt;
| predict count as prediction algorithm=LLP future_timespan=200 holdback=0&lt;BR /&gt;
| eval residual=count-round(prediction,0)&lt;BR /&gt;
| streamstats window=200 current=true median(residual) as median_of_residual&lt;BR /&gt;
| eval abs_dev=(abs(residual - median_of_residual))&lt;BR /&gt;
| streamstats window=200 current=true median(abs_dev) as median_abs_dev&lt;BR /&gt;
| eval upper_bound=(median_of_residual + median_abs_dev * 20) &lt;BR /&gt;
| eval anomaly=if(residual &amp;gt; upper_bound,1,0)&lt;/P&gt;

&lt;P&gt;so this is my query and I want to add&lt;/P&gt;

&lt;P&gt;|table event, anomaly, count&lt;/P&gt;

&lt;P&gt;but for some reason the "event" field is null. can anyone explain why? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:59:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383300#M111931</guid>
      <dc:creator>kiamco</dc:creator>
      <dc:date>2020-09-29T19:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: when using predict fields become null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383301#M111932</link>
      <description>&lt;P&gt;When you can't figure out where a field gets "lost", drop one command at a time from the query until the field appears.  The last command dropped is the culprit.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 03:17:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383301#M111932</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-06-14T03:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: when using predict fields become null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383302#M111933</link>
      <description>&lt;P&gt;yup did that and it gets lost after the predict command in the query. I'm just wondering why or is there any way to get those fields back?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 03:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383302#M111933</guid>
      <dc:creator>kiamco</dc:creator>
      <dc:date>2018-06-14T03:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: when using predict fields become null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383303#M111934</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You are applying a table command after a timechart and prediction command. There is actually, no event command from your timechart - your timechart (and the subsequent fields like residual,anomaly etc.) are all based on evals of count. There is no way events are going to be captured AFTER you apply a timechart command and just use the count , based on the timechart for further processing.&lt;BR /&gt;
For example, if i write something like this &lt;CODE&gt;| eval event="vvvv" | table |table event, anomaly, count&lt;/CODE&gt; , then you will receive an event field with vvv as the field values, see what I mean?&lt;BR /&gt;
It is difficult to say what actually you want under the event field , but if I just slightly modify your timechart command to something like this -  &lt;CODE&gt;|timechart span=5m sum(count) as count, values(_raw) as event&lt;/CODE&gt; and then run the rest of your query (including |table event,anomaly,count) you WILL get values under the event field (event =_raw) in this case.&lt;BR /&gt;
My example is bad and the query takes a long time to execute, try running this for last 15 mins. What i did was select the _audit index so that you can use the code as it is, run this code for the lats 15 minutes and see the otuput &lt;CODE&gt;index="_audit" |  timechart span=5m sum(count) as count, values(_raw) as event&lt;BR /&gt;
| predict count as prediction algorithm=LLP5 future_timespan=200 holdback=0&lt;BR /&gt;
| eval residual=count-round(prediction,0)&lt;BR /&gt;
| streamstats window=200 current=true median(residual) as median_of_residual&lt;BR /&gt;
| eval abs_dev=(abs(residual - median_of_residual))&lt;BR /&gt;
| streamstats window=200 current=true median(abs_dev) as median_abs_dev&lt;BR /&gt;
| eval upper_bound=(median_of_residual + median_abs_dev * 20) &lt;BR /&gt;
| eval anomaly=if(residual &amp;gt; upper_bound,1,0)|table event, anomaly, count&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;So, either you need to include what you mean by event in the timechart(your prediction for count will remain unscathed ) OR define something using an eval for the event to pick values&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:00:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383303#M111934</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-29T20:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: when using predict fields become null</title>
      <link>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383304#M111935</link>
      <description>&lt;P&gt;it works!! thanks a lot for the very detailed answer&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 20:20:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/when-using-predict-fields-become-null/m-p/383304#M111935</guid>
      <dc:creator>kiamco</dc:creator>
      <dc:date>2018-06-15T20:20:50Z</dc:date>
    </item>
  </channel>
</rss>

