All Apps and Add-ons

Need to Time Shift one data point by X minutes for Machine Learning Application

gdziuba
Explorer

index="index" | table _time, ItemName, Measurement | rex mode=sed field=ItemName "s/[#-%&\$*+(). 0123456789]//g" | timechart span=10s last(Measurement) by ItemName limit=0 | outlier action=rm |

I have a column name called thickness and am trying to shift its data point by 1 min in this example. I don't want to shift all data points, just the one column.

Machine Learning Tool is Predict Categorical Fields.

Any help would be greatly appreciated.

0 Karma

gdziuba
Explorer

This is what I used to shift time. I used append and added the following code to shift time by x.

eval _time = relative_time(_time,"-50s")

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

So in other words, you want to shift the thickness column down by six rows?

Do something like this after the timechart:

... | streamstats window=6 first(thickness) as shifted_thickness | ...

I didn't test if you need 6 or 7, and first() or last() - I always confuse the two. Just give it a shot and see how it behaves, adjust accordingly.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

I see. streamstats walks along the events in the order they are input into streamstats, which by Splunk default is reverse time order. It then looks back, so you get later in time easily.

One simple way would be to run reverse before and after the streamstats... would be slow though, depending on number of events. Another way would be to not copy the timestamp over by six events, but rather copy the value over by six events. Effectively that would shift the time in the other direction.

0 Karma

gdziuba
Explorer

This almost does what I need. It shifts in the wrong direction. If I do last(thickness) time isn't shifted at all, and if I do first(thickness) it goes later in time. I want it to be shifted up in time.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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