Splunk Search

How can I make a field that contains a time series window group of 3 events?

andrewhnguyen
New Member

Is there a way I can group a window of 3 time points and add it as a field with the last two remaining being ignored?
I'm trying to classify time series patterns using a support vector machine with the Splunk MLTK and I'm unsure how to get the data in these windows.

(ex) My data has the _time and amount fields, and I would like to add the windows field:
1. _time amount windows
2. XX:12:XX 6 [ 6, 8, 4]
3. XX:13 XX 8 [8, 4, 4]
4. XX:14:XX 4 [4, 4, 3]
5. XX:15:XX 4 [ 4, 3, 2]
6. XX:16:XX 3 ...`
7. XX:17:XX 2 ...
`

Tags (1)
0 Karma

to4kawa
Ultra Champion
| makeresults count=2
| streamstats count
| eval _time=if(count=2,relative_time(_time,"-2d@d"),relative_time(_time,"-1d@d")) 
| makecontinuous span=1h _time
| eval amount=random() % 10 +1 
| table _time amount
`comment("from here, the logic")`
| reverse
| streamstats window=3 list(amount) as windows 
| reverse
| eval windows="[ ".mvjoin(windows," ")." ]"

Hi, @andrewhnguyen
how about this?

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...