Splunk Search

How to use fit command together with foreach?

Wonjon
Observer

I would like to fit an ARIMA model to my data with a search something like this:

<base search>
| timechart span=5m avg(value) as value by some_field

The problem here is that, the number of field that returns by this search is dynamic, so it can return 5 fields one day but it could also return 3 or 7 the other day for instance.

I would like to fit an ARIMA model to all the fields that is returned by that search. What I found was the foreach command where you iterate over fields :

| foreach * [eval '<<FIELD>>' = ... ]

 

However, when I try to use the fit command instead of eval, I get an error message saying: 

Error in 'foreach' command: Search pipeline may not contain non-streaming commands

Since foreach cannot contain non-streaming commands.

 

Is there a way to come around this issue?

Labels (3)
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...