Deployment Architecture

Can you help me SNAP to the nearest 30min?

jadengoho
Builder

Hi all ,

I basically want to snap my time to the nearest 30 min. Like round of the the 30min.

Example :
1) TIME_NOW = 12:45 , earlier 30min is 12:30
2) TIME_NOW= 12:59 , earlier 30min is 12:30
3) TIME_NOW = 1:01 , earlier 30min is 1:00

thanks in advance

Tags (2)
0 Karma
1 Solution

HiroshiSatoh
Champion

I converted it into time and used BIN.

| makeresults |eval TIME_NOW = "12:45"
| append [| makeresults |eval TIME_NOW = "12:55"]
| append [| makeresults |eval TIME_NOW = "13:01"]
| eval TIME_NOW=strptime(TIME_NOW,"%H:%M")
| bin TIME_NOW span=30m|stats count by TIME_NOW
| eval TIME_NOW=strftime(TIME_NOW,"%H:%M")

View solution in original post

0 Karma

jadengoho
Builder

HI, woodcock and Hiroshi Satoh,
I have tried it on doing on a query But I will be needing this on the time picker advance option.
Cause I will use it on both dashboard panel and save search settings.
alt text

0 Karma

jadengoho
Builder

Is there a way i can do this on the time range picker

0 Karma

woodcock
Esteemed Legend

I have no idea what you mean.

0 Karma

jadengoho
Builder

i just want to round of the time now to the earliest 30min,
example the time now is 12:45, the time that it will get is 12:30.

can this be done on the time range picker itself

0 Karma

woodcock
Esteemed Legend

Just add this to your search:

... | bucket TIME_NOW span=30m@m
0 Karma

HiroshiSatoh
Champion

I converted it into time and used BIN.

| makeresults |eval TIME_NOW = "12:45"
| append [| makeresults |eval TIME_NOW = "12:55"]
| append [| makeresults |eval TIME_NOW = "13:01"]
| eval TIME_NOW=strptime(TIME_NOW,"%H:%M")
| bin TIME_NOW span=30m|stats count by TIME_NOW
| eval TIME_NOW=strftime(TIME_NOW,"%H:%M")
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 ...