<?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 predict future_timespan value as a calculated variable in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/predict-future-timespan-value-as-a-calculated-variable/m-p/486409#M193676</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am trying to use the predict function to predict hourly values through to the end of the current day. To do this I need to pass to the future_timespan option a decreasing number as the day progresses. ie at midday future_timespan = 12, at 3pm future_timespan=9 etc. &lt;/P&gt;

&lt;P&gt;I have some fairly ugly eval statements that give me a value of the number of hours remaining in the current day, however, I don't see how I can pass a value back to the command as a variable. &lt;/P&gt;

&lt;P&gt;Any hints greatly appreciated. &lt;BR /&gt;
David&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:42:43 GMT</pubDate>
    <dc:creator>danan5</dc:creator>
    <dc:date>2020-09-30T03:42:43Z</dc:date>
    <item>
      <title>predict future_timespan value as a calculated variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/predict-future-timespan-value-as-a-calculated-variable/m-p/486409#M193676</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am trying to use the predict function to predict hourly values through to the end of the current day. To do this I need to pass to the future_timespan option a decreasing number as the day progresses. ie at midday future_timespan = 12, at 3pm future_timespan=9 etc. &lt;/P&gt;

&lt;P&gt;I have some fairly ugly eval statements that give me a value of the number of hours remaining in the current day, however, I don't see how I can pass a value back to the command as a variable. &lt;/P&gt;

&lt;P&gt;Any hints greatly appreciated. &lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:42:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/predict-future-timespan-value-as-a-calculated-variable/m-p/486409#M193676</guid>
      <dc:creator>danan5</dc:creator>
      <dc:date>2020-09-30T03:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: predict future_timespan value as a calculated variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/predict-future-timespan-value-as-a-calculated-variable/m-p/486410#M193677</link>
      <description>&lt;P&gt;So finally worked out how to do it, was a knowledge gap on my part. I didn't understand the "." option in the eval command to concatenate a string with a calculated value, and the sub search returning it all as an option/variable to the predict command. &lt;/P&gt;

&lt;P&gt;Below is an example, generating prediction of data ingest through to the end of the current day. &lt;/P&gt;

&lt;P&gt;index=_internal source=&lt;EM&gt;license_usage.log&lt;/EM&gt; type=Usage earliest=@d | eval gb=b/1024/1024/1024&lt;BR /&gt;
| reverse &lt;BR /&gt;
| accum gb as totalb&lt;BR /&gt;
| timechart last(totalb) span=1m as tc_totalb&lt;BR /&gt;
| predict tc_totalb algorithm=LLT holdback=1 [| gentimes start=-1 | eval search="future_timespan=".round((relative_time(now(),"+1d@d")-now())/60) | table search] AS predicted_usage&lt;BR /&gt;
| eval upper95(predicted_usage)=if(_time&amp;lt;=now(), predicted_usage, 'upper95(predicted_usage)' )&lt;BR /&gt;
| eval lower95(predicted_usage)=if(_time&amp;lt;=now(), predicted_usage, 'lower95(predicted_usage)' ) &lt;BR /&gt;
| rename tc_totalb as "Data Ingested"&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:51:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/predict-future-timespan-value-as-a-calculated-variable/m-p/486410#M193677</guid>
      <dc:creator>danan5</dc:creator>
      <dc:date>2020-09-30T03:51:00Z</dc:date>
    </item>
  </channel>
</rss>

