Splunk Search

snap to 10 minutes

dadi
Path Finder

Hi ,
I want to snap to 10 minutes.
I know how to snap to an hour for example:
... | eval _time=relative_time(_time,"@h")

However, this doesn't work for 10 minutes time. Is there any other way to do it?

Thanks

Tags (1)
0 Karma
1 Solution

jonuwz
Influencer

You're probably looking for the bin/bucket command :

It "bins" values into discrete sets (or buckets)

This should do it.

... | bin _time span=10m  | ...

John

View solution in original post

morethanyell
Builder

Making time snap to the next 10th minute

| makeresults 
| eval now = now() 
| eval now_snapped_to_next_10th_min = relative_time(now(), 
    [| makeresults 
    | eval now = now() 
    | convert ctime(now) 
    | rex field=now "\d(?<min>\d)\:(?:\d{2})$" 
    | eval min = 10 - min 
    | eval min = if(min == 10, 0, min) 
    | eval adder = "\"+" . tostring(min) . "m@m\"" 
    | return $adder])
| convert ctime(now*) timeformat="%F %X"
0 Karma

charleswheelus
Path Finder

jonuwz
Influencer

You're probably looking for the bin/bucket command :

It "bins" values into discrete sets (or buckets)

This should do it.

... | bin _time span=10m  | ...

John

Get Updates on the Splunk Community!

Splunk Platform | Upgrading your Splunk Deployment to Python 3.9

Splunk initially announced the removal of Python 2 during the release of Splunk Enterprise 8.0.0, aiming to ...

From Product Design to User Insights: Boosting App Developer Identity on Splunkbase

co-authored by Yiyun Zhu & Dan Hosaka Engaging with the Community at .conf24 At .conf24, we revitalized the ...

Detect and Resolve Issues in a Kubernetes Environment

We’ve gone through common problems one can encounter in a Kubernetes environment, their impacts, and the ...